Jump to content

javascript help


Guest maria

Recommended Posts

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

can anybody tell me how to declare global variables............as oppose to local variables.........and can you also give a little example plzzzzzzzzthank you

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...