Quantcast
Viewing all articles
Browse latest Browse all 9

JavaScript Tip of the Day

Today I learned a neat trick for keeping the global namespace on a page clean.  Lets say you have the following code:

This code will introduce 3 new global items which can be messy and undesirable.  The alternative to this which will keep the global namespace free of junk is to encapsulate the above code into an anonymous function like so:

The post JavaScript Tip of the Day appeared first on MetroStar Systems Blog.


Viewing all articles
Browse latest Browse all 9

Trending Articles