We are constantly accelerating upwards and outwards from the Earth. I know, I can feel it.” Anon
A resource for web developers a code snippet library with step by step tutorials.

a resource for web developers...

       

Search Amazon

Scope of variables declared in a function and in the surrounding program


Local and global variables.

 

See JavaScript: Basics for tutorials.


A section of code implemented as a function cuts itself off from the surrounding program code and the variables declared in a function are only available to that function and are not available by name to the surrounding program: the variables declared in a function are said to be local to that function and are out of scope to the surrounding program.

 

Variables declared in the surrounding program are described as global variables.

 

Functions can declare local variables that have the same name as global variables declared in the surrounding program. If a function declares a local variable with the same name as a global variable then the global variable is inaccessible to that function.

 

 

 

 

Back to top.

 

Bookmark and Share

 

Copyright © 2006-2010 justfigures.co.uk