What is 'this'?
I've always had a problem with identifying the JS keyword 'this'. What is it referencing? What does it represent? The best way I've come to understand it is in the simple case of an object literal. Take a look at the image below.
We have an object literal 'hotel'. Within the hotel are several properties and a checkAvailability method. 'this' within the checkAvailability method refers to the object itself. Even when we use function constructors or other JS object patterns, 'this' keyword references properties that are used within the instance of the object.