Search w3schools.com:

SHARE THIS PAGE

JavaScript undefined Property

Function Reference JavaScript Global Functions

Definition and Usage

The undefined property indicates that a variable has not been assigned a value.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The undefined property is supported in all major browsers.


Example

Example

Test if variables are undefined:

<script>

var t1="";
var t2;

if (t1===undefined)
{
alert("t1 is undefined");
}
if (t2===undefined)
{
alert("t2 is undefined");
}

</script>

The output of the code above will be:

t2 is undefined

Try it yourself »


Function Reference JavaScript Global Functions

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]