[Javascript] "var" keyword
Peter-Paul Koch
gassinaumasis at hotmail.com
Tue Apr 23 03:10:49 CDT 2002
>I can declare my variables with the "var" keyord, or not. I can delete a
>variable with "delete" keyword or not. But what is the real diference and
>how should I do?
If you declare a variable inside a function by using the 'var' keyword, it
becomes a local variable:
var theVar = 'global';
function doSomething()
{
alert (theVar) // gives 'global'
var theVar = 'local';
alert (theVar) // gives 'local'
}
As to delete, I never use it and I seem to remember Flanagan said it's not
very important in JavaScript.
ppk
_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com
More information about the Javascript
mailing list