JavaScript Variable Scope - Stack Overflow: " think about the best I can do is give you a bunch of examples to study. Javascript programmers are practically ranked by how well they understand scope. It can at times be quite counter-intuitive.
// a globally-scoped variable
var a=1;
// global scope
function one(){
alert(a);
}"
'via Blog this'