5 ms·
It's all about scope. What you should do is read about scope in javascript and get to know it well. Then stuff like this will come naturally or you'll at least
by user2459 15y ago
It's all about scope. What you should do is read about scope in javascript and get to know it well. Then stuff like this will come naturally or you'll at least understand why people program like this and that it's not just some language peculiarity.
MDN: https://developer.mozilla.org/en/JavaScript/Reference/Functions_and_function_scope https://developer.mozilla.org/en/JavaScript/Reference/Functi...
short stack overflow: http://stackoverflow.com/questions/500431/javascript-variable-scope http://stackoverflow.com/questions/500431/javascript-variabl...