How to handle Global Variable scope issue in JavaScript

Posted on Updated on

One of the major problem with JavaScript is the leakage of scope and which leads to various issues as such variable name conflict. One of the best practice of JavaScript is to use to one global object variable and dynamically add variables to it or defines the variable as object property. This will restrict the variable scope and will help limit scope leakage. This way variables are restricted to one Global Variable scope.
Read the rest of this entry »