JavaScript undefinedProperty

函数参考手册JavaScript Global Functions

Definition and Usage

The undefined property is used to store the undefined value in JavaScript.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the undefined property.


Example

Example

Detect whether a variable is defined:

<script>

var t1="";
var t2;

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

</script>

The above example outputs:

t2 is undefined

Try it Yourself »


函数参考手册JavaScript Global Functions Other Extensions