Grab the RSS feed

Declare the variable globally in Java script

Today I am facing the problem of get the value from the variable that declared inside the function. But I need to get that value from outside of the function.

For that we need th declare the variable globally is the best way of doing program.

In Java script it is simple technique to globally declare the variable.

How can you declare the variable globally?

Is we need to put global infront of that.No…

See the following program…..

Function1()

{

Var myname;//declared globally

Function2()

{

Var myaddress;//with in the function

Myname//access in this function

}

Function3()

{

Myname;

}

}

When accessing the global variable don’t put var within the function…

Read and use it.Leave the comments for improvements…

 
Real Time Web Analytics