Dealing with JavaScript Scope
Over at Ajaxian, they've offered up a useful tip for dealing with code that exists in the global namespace and is conflicting with other scripts: move it into its own function. Example:
(function() {
// do you stuff here!
})();
What's the global namespace? That's the window object. Any time you instantiate a global variable, it is automatically part of the window object.
var myvar = 5;
alert(window.myvar); // alerts '5'
For more information on scope, be sure to check out my recent article on Digital Web on that very topic.
TIPS, TRICKS & BOOKMARKS on WEB DEVELOPMENT
I'm Jonathan Snook and I write about web design and development. I 








Conversation
That's what object notation is for. You nearly avoid all instances of other global properties.