What does 'this' refer to?

I’m going through the ‘Intro to Node.js’ portion of the Website Starter Kit. I’m wondering what the keyword ‘this’ refers to in the file ‘app.js’.

Here’s my code: https://glitch.com/edit/#!/node-lemur

You mean the this keyword in line 58?

Yeah, line 58 in the file app.js

In that context of the scope, this refers to resolutionsRequest, which calls on line 75 new XMLHttpRequest();. That’s why the script can access to responseText.

Check this example out (source):

var req = new XMLHttpRequest();
req.open('GET', 'http://www.mozilla.org/', false); 
req.send(null);
if (req.status == 200)
  dump(req.responseText);