Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] "var" keyword


  • From: javascript@xxxxxxxxxx (Dan Costea)
  • Subject: [Javascript] "var" keyword
  • Date: Tue, 23 Apr 2002 10:15:59 -0700

This is a multi-part message in MIME format.

------=_NextPart_000_0040_01C1EAAF.DD4E30F0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

    Hello all,

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?

Interesting (at least for me) example:

var x =3D 1;
y =3D 2;

alert (x);
alert (y);

delete x;
alert (x);=20

delete y;
alert (y);


I am a little confused... I woul appreciate any clarification for you.
Thanks, Dan.

------=_NextPart_000_0040_01C1EAAF.DD4E30F0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; Hello =
all,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I can declare&nbsp;my variables with =
the "var"=20
keyord, or not. I can delete a variable with "delete" keyword or not. =
But what=20
is the real diference and how should I do?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Interesting (at least for me) =
example:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>var x =3D 1;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>y =3D 2;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>alert (x);
<DIV><FONT face=3DArial size=3D2>alert (y);</FONT></DIV>
<DIV>&nbsp;</DIV></FONT></DIV></FONT><FONT face=3DArial =
size=3D2></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>delete x;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>alert (x); </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>delete y;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3DArial size=3D2><FONT =
face=3DArial=20
size=3D2><FONT face=3DArial size=3D2>alert (y);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>I am a little confused... I woul appreciate any clarification for=20
you.</DIV>
<DIV>Thanks, Dan.</DIV></FONT></FONT></FONT></BODY></HTML>

------=_NextPart_000_0040_01C1EAAF.DD4E30F0--