“This” in JavaScript
The author critically misunderstands the way that `this` gets set, and in doing so has developed a significantly overcomplicated mental model.  This is exemplified in the statement:<p><i>You can use this in any function on an object to refer to other properties on that object. This is not the same as an instance created with new. ... Note, there was no use of new , no Object.create and no function called to create obj.</i><p>This is exactly the same behavior that you see on an object method reference, and drawing any distinction at all makes understanding the behavior of <i>this</i> harder than it needs to be.<p>In nearly every case (with the exception of <i>bind</i>, <i>call</i> and <i>apply</i>) the <i>this</i> variable is set at the CALL SITE of the function, NOT THE DEFINITION.  Note that in the three other cases, you still aren't setting <i>this</i> at the definition.<p>The reason you get <i>this</i> behaving as the author describes on objects created with <i>new</i> is only (as the author nearly, but not quite, realizes) because you called the function in the form:<p><pre><code>    thing.method()
</code></pre>
Specifically, it is the object reference that sets the <i>this</i> context within the method call.<p>You can be sure that the object literal case is just the same.  You don't need to call <i>new</i> to get an object reference that has a prototype chain: namely, an object literal is instantiated with the prototype <i>Object</i>.  You can verify this is true with a simple:<p><pre><code>    thing = {}
    thing.hasOwnProperty === Object.hasOwnProperty
</code></pre>
...and so forth.