Tuesday, January 3, 2012

Global Variables

why not to use global variable in javascript ?

JavaScript is not good in dealing with global variables .Global variable is a variable that is visible in every scope. javascript does not support Classes like  C /C++ , But we can use functions to encapsualte data.But use of global variable in a large project is not a good programming practice. it can be easily vulnerable for any large project. because being dependent on global variable degrade the reliability of the program . and can easily access to make changes in whole program . so generally we  avoid the use of global variable in javascript in large projects , it may b use in small programs .

No comments:

Post a Comment