Variables declared with var are permanent: attempting to delete them with the delete operator causes an error.
Variables declared without var are implicitly declared as global variables, even if you’re inside the body of a function.
It’s best to use var all the time–regardless of whether it’s local or global.
There is no block scope; all variables declared within a function are defined throughout the function.
It doesn’t matter when a variable is declared within it’s scope. Even if it’s defined 10 lines down from the current statement, you have access to it (although it is undefined).
Use for in when you need access to the keys of an associative array.
Use for each in when you need access to the values of an associative array.