1 August 2011

Good to know: How scope is manage in Javascript?

For some resons my brain resists to understand scope in JavaScript,but this sentence helps me a little bit (At least until i forgot about that).

  "JavaScript uses functions to manage scope. A variable declared inside of a function is
local to that function and not available outside the function. On the other hand,
global variables are those declared outside of any function or simply used without being
declared." 

Source:  Stoyan Stefanov  - JavaScript Patterns