W3Schools.com

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 type="text/javascript">

var t1="";
var t2;

if (t1==undefined)
{
document.write("t1 is undefined");
}
if (t2==undefined)
{
document.write("t2 is undefined");
}

</script>

The output of the code above will be:

t2 is undefined

Try it yourself »


Function Reference JavaScript Global Functions
WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$7.95/mo SEO Hosting
Premium Website Design
WEB BUILDING
XML Editor - Free Trial!
FREE Website BUILDER
Free Website Templates Free CSS Templates
Make Your Own Website
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE