That's a good example. An arrow function does not have its own this context and hence it always points out to the parsnts one ( in this case an object that is calling the function perimeter is under yhe global window object in terms of context and hence this refers to window)
That's a good example.
An arrow function does not have its own this context and hence it always points out to the parsnts one ( in this case an object that is calling the function perimeter is under yhe global window object in terms of context and hence this refers to window)
Thanks for reminding me, I always forget that.
Arrow function has not it's own this
In this context it's borrowed the context of parent environment of the current function 😅
Use regular function instead of arrow right? In arrow functions this refers to undefined
Arrow functions don't have their own this.
They take this from the nearest enclosing regular function or global scope.
@@averageguy7044 In its lexical scope 👍
If I am not wrong "this" in an arrow don't even refer to window object I guess so always undefined or nan will be the answer
Then whats the solution