Tutorial by Examples

//Before: antipattern 3 global variables var setActivePage = function () {}; var getPage = function() {}; var redirectPage = function() {}; //After: just 1 global variable, no function collision and more meaningful function names var NavigationNs = NavigationNs || {}; N...
When multiple modules are involved, avoid proliferating global names by creating a single global namespace. From there, any sub-modules can be added to the global namespace. (Further nesting will slow down performance and add unnecessary complexity.) Longer names can be used if name clashes are an i...

Page 1 of 1