what does this. mean in javascript code example
Example 1: 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"
Example 2: how to use this in js
// 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"
Example 3: what does the ... mean in javascript
const x = [1,2,3,4,5];
Math.max(x) // NaN
Math.max(...x) // 5
// Math.max(...x) = Math.max(1,2,3,4,5)