Variable scoping has always been a part of every programming language. Whether we are using a class based object oriented language (e.g. Java/C#) or a class-less object oriented language, scope has a very important role to play.
What scope defines?
In easiest terms, scope defines the visibility of any variable/data. In JavaScript, you can define a piece of code (function/method) globally or you can keep it within an object and expose it for public use. The keyword 'this' has a special significance when it comes to JavaScript. Other languages also use the 'this' keyword but it needs some serious attention if you are trying to use or understand it in JavaScript world.
Your new post is loading...