shohagbhuiyan.com
Accessing variables from other functions without using global variables
var MyApp = {}; // Globally scoped object function foo(){ MyApp.color = ‘green’; } function bar(){ alert(MyApp.color); // Alerts ‘green’ }