I dont understand why it returns [NaN, Infinity, Infinity] and why NaN will be returned
What is this referred to in the example 2 without arrow expression? Thanks for your help
I have read the difference of this in => and regular function
I understand the difference but I still don’t know why the this in example 2 points to the window object
function normalize() {
console.log(this.coords.map(function (n){return n/this.length}));
}
nside a function, the value of this depends on how the function is called.
Since the following code is not in strict mode, and because the value of this is not set by the call, this will default to the global object, which is window in a browser.