JavaScript undefinedProperty
JavaScript Global Functions
Definition and Usage
The undefined property is used to store the undefined value in JavaScript.
Browser Support
![]()
![]()
![]()
![]()
![]()
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>
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