December 2016
Intermediate to advanced
841 pages
17h
English
In JavaScript, the this operator behaves a little differently than other languages. The value of the this operator is often determined by the way a function is invoked. Its value cannot be set by assignment during execution, and it may be different each time a function is invoked.
The this operator also has some differences when using the strict and nonstrict modes. To learn more about the strict mode, refer to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode.
In the global context, the this operator will always point to the global object. In a web browser, the window object is the global object:
console.log(this === window); // true this.a = 37; console.log(window.a); ...
Read now
Unlock full access