Quick References
ADO
ASP
CSS2
HTML
JavaScript
Jet SQL
VBScript
WML
WMLScript
WSH
XHTML
XML DOM
XSLT
Features
Knowledge Base
Tutorials
Partners
ZVON.ORG
XML
Planet Source Code
VisualBuilder
Web Design
Your HTML Source
XML/XSLT Forums
ASPAlliance
Scripts
Programmers Heaven
Tek-Tips Forums
Developer Fusion
Code Project
All Primitive Values
Primitive Value: Undefined
Undefined
In ECMAScript,
Undefined
is classified as a primitive value. Your ability to use
Undefined
will be extremely dependent upon the type and version of your browser.
There are two definitions for
Undefined
. It can refer to a variable that has never been declared. Or it can refer to a variable that has been declared, but has not been assigned a value. The ECMA-262 standard uses the second version to define
Undefined
.
Undefined
is also a type. You can use the
typeof
operator to determine the type of a variable and it will return a type of "undefined" for an
Undefined
variable.
For this example, the value NotThere has not been declared. (Note that it is optional to enclose the argument for the
typeof
operator inside a pair of parenthesis.)
Code:
document.write("NotThere is of type = " + typeof NotThere)
Output:
NotThere is of type = undefined
In this example, the value IsThere has been declared, but it is not assigned a value.
Code:
var IsThere;
document.write("IsThere is of type = " + typeof IsThere)
Output:
IsThere is of type = undefined
NOTE:
In Internet Explorer, if you attempt to utilize an undefined variable, you will get a runtime error message.
Copyright 1999-2005 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information