Skip to navigation

Variable scope in JavaScript

Here’s a very nice summary of the scope of variables in JavaScript, i.e. where in your script they’re availalbe.

An important point that I needed for a script: If you need to declare a variable inside a function but need its scope to be global, omit the var keyword.

Comments are closed.