Add new comment

#9 Locals are still a good idea - Lessons Learned While Reading "Effective Javascript"

Variables declared inside of a function will automatically be made global unless it is prefixed with "var".

function foo() {
    bar = "hi";   // Global
    var qux = "hola"; // Local 
}

You can use a tool such as jslint to spot such mistakes.