07.06.2010
Your own scope or execution context in Javascript is important to avoid conflicts with instanced objects and variable names. var myVar=' - context0', toTitle = function(txt){ document.title+=txt; }; (function(){ var myVar=' - context1'; toTitle(myVar); })(); (function(){ var myVar=' - context2'; toTitle(myVar); })(); toTitle(myVar); Take a look at the page title to see how this example [...]