interviews.dotnetthread.com

↑ Grab this Headline Animator

Tuesday, June 3, 2008

Can i access javascript gobal variable using window object?

Yes,
Any global variable declared outside the function in Javascript get attached or added to window object.
Ex:
var myvar = 5;
function myFunction()
{
alert(window.myvar);// gives 5
window.myvar = 100;
alert(window.myvar);// gives 100
}

Submit this story to DotNetKicks

No comments:

Post a Comment

Post your comments/questions/feedback for this Article.

 

Latest Articles