Variable scope

    Variable scope refers to where a variable exists.

    variable can be defined using var keyword

function cube(number)
{
    var cube=number*number*number;
    return cube;
}

    Any variable declared using the var command within the function will have a scope limited to the function.

    If the variable is declared outside the body of a function, it is available throughout a script.

 

Send mail to santhosh_emids@yahoo.com with questions or comments about this web site.
Last modified: November 16, 2000