JavaScript Datatypes

JavaScript has the following types:

Numbers

Integers

A number starting with 0 will be a octal notation. (digits 0-7) Example: 0754.

A number starting with 0x or 0X will be hexadecimal notation. Example: 0x7aff. (cap case can also be used).

Floating Point Number

Contains a decimal point “.” or “e”. The e or E indicates exponential notation. Example: 9.32e3.

Booleans

The values are: “true” and “false”.

The following are considered false: 0, null, false, NaN, undefined, or the empty string ("").

Strings

For example: "something".

Objects

Example:

myObj = new Object();

and may others.

null

A special value “null”. This can be assigned to function or variable to undefine them.

undefined

When a variable has not been assigned, it is “undefined”.

Reference:


See also:


Page created: 2005-05.
© 2005 by Xah Lee.
Xah Signet