Ajax in Java Script (Code) Video- Not getting if block

httpRequest.onreadystatechange = function(){
if (this.readyState == 4 && this.status == 200) {
user_data = JSON.parse(this.responseText);
document.getElementById(“output”).innerHTML = user_data.data.first_name;

Please make me understand above code

Why
if (this.readyState == 4 && this.status == 200) {

In this code, the event handler checks if the readyState is equal to 4 and the status is equal to 200. If both conditions are true, it means that the request was successful and the response is ready. The response is then parsed using JSON.parse and stored in a variable user_data.