JavaScript undefined Property
- Previous Page String()
- Next Page unescape()
- Go Up One Level JavaScript Global Reference Manual
Definition and Usage
undefined
Properties indicate that the variable has not been assigned a value, or it has not been declared at all.
Instance
Example 1
Test if a variable is undefined:
var x; if (typeof x === "undefined") { txt = "x is undefined"; } else { txt = "x is defined"; }
Example 2
Test if an undeclared variable is undefined:
if (typeof y === "undefined") { txt = "y is undefined"; } else { txt = "y is defined"; }
Technical Details
JavaScript Version: | ECMAScript 1 |
---|
Browser Support
Properties | Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
undefined | Support | Support | Support | Support | Support |
- Previous Page String()
- Next Page unescape()
- Go Up One Level JavaScript Global Reference Manual