this on a javascript function code example
Example 1: define function in javascript
/* Declare function */
function myFunc(param) {
// Statements
}
Example 2: javascript this
// In web browsers, the window object is also the global object:
console.log(this === window); // true
a = 37;
console.log(window.a); // 37
this.b = "MDN";
console.log(window.b) // "MDN"
console.log(b) // "MDN"