1The JavaScript this keyword refers to the object it belongs to.
2It has different values depending on where it is used: In a method,
3this refers to the owner object. Alone, this refers to the global
4object.
1// In web browsers, the window object is also the global object:
2console.log(this === window); // true
3
4a = 37;
5console.log(window.a); // 37
6
7this.b = "MDN";
8console.log(window.b) // "MDN"
9console.log(b) // "MDN"
10