What is 'this' in JavaScript
If you are learning JavaScript or been into for a while, then you would have encountered a pretty tricky concept of JS. The concept of this.
So, let us explore together what does this means.
In JavaScript, this keyword refers to the object it belongs...
pranavbakale.hashnode.dev3 min read
Sanjay Vyas
Code Visualiser; Technosaurus Rex; Removing software chaos, one program at at ime
It differs in node.
this.count = 0; will not go to global dictionary, rather into the object for which the top level anonymous function is called.
console.log(global.count); // undefined console.log(this); // { count: 0 }