Guest maria Posted October 18, 2005 Share Posted October 18, 2005 can anybody tell me how to declare global variables............as oppose to local variables.........and can you also give a little example plzzzzzzzzthank you Link to comment Share on other sites More sharing options...
maelstorm Posted October 18, 2005 Share Posted October 18, 2005 can anybody tell me how to declare global variables............as oppose to local variables.........and can you also give a little example plzzzzzzzzthank you<{POST_SNAPBACK}> outside the javascript functions are global and once that are declared inside the function will be local to that function..... var a = 10;disp_a();function disp_a() { var a = 20; alert("Value of 'a' inside the function " + a); }alert("Value of 'a' outside the function " + a);this example will alert twice, first with the local variable then followed by the global variable......Maelstorm.. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now