js this code example
Example 1: javascript this
console.log(this === window);
a = 37;
console.log(window.a);
this.b = "MDN";
console.log(window.b)
console.log(b)
Example 2: js this in object
var wF = {
w : 560,
h : function() { return (312 - 42) / (560 / this.w) + 42; }
};
alert(wF.h())
Example 3: this javascript
console.log(this === window);
a = 37;
console.log(window.a);
this.b = "MDN";
console.log(window.b);
console.log(b);
Example 4: how to use this in js
console.log(this === window);
a = 37;
console.log(window.a);
this.b = "MDN";
console.log(window.b)
console.log(b)