JavaScript syntax: Difference between revisions

Content deleted Content added
be clear with the naming in your code
Tags: Mobile edit Mobile app edit iOS app edit
Synoli (talk | contribs)
Line 114:
===Declaration and assignment===
 
Variables declared outside a scope are in [[global variable|global]]. If a variable is declared in a higher scope, it can be accessed by child scopes.
 
When JavaScript tries to '''resolve''' an identifier, it looks in the local scope. If this identifier is not found, it looks in the next outer scope, and so on along the ''scope chain'' until it reaches the ''global scope'' where global variables reside. If it is still not found, JavaScript will raise a <code>ReferenceError</code> exception.