I was studying async, callback and waiting for file. I came across the given example and I am having a hard time understanding whom does "this" given in this code belongs to. Please help.
function myDisplayer(some) {
document.getElementById("demo").innerHTML = some;
}
function getFile(myCallback) {
let req = new XMLHttpRequest();
req.open('GET', "mycar.html");
req.onload = function() {
if (req.status == 200) {
myCallback(this.responseText); // Refering to this- "this"
} else {
myCallback("Error: " + req.status);
}
}
req.send();
}
getFile(myDisplayer);
<div id="demo"></div>