11.12.2012 Views

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

JavaScript 2.0-The Complete Reference, Second ... - freecodingtutorial

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Table A-7: Primitive <strong>JavaScript</strong> Data Types<br />

Type Description Values Literal Syntax<br />

or true/false<br />

values and<br />

conditionals.<br />

null Has only one<br />

value. Indicates<br />

the absence of<br />

data, for<br />

example, placed<br />

in unspecified<br />

function<br />

argument.<br />

number Includes both<br />

integer and<br />

floating-point<br />

types. 64-bit<br />

IEEE 754<br />

representation.<br />

Integer ops<br />

usually carried<br />

out using only 32<br />

bits.<br />

string Zero or more<br />

Unicode (Latin-1<br />

prior to Netscape<br />

6/IE4)<br />

characters.<br />

undefined Has only one<br />

value and<br />

indicates that<br />

data has not yet<br />

been assigned.<br />

For example,<br />

undefined is the<br />

result of reading<br />

a non-existent<br />

object property.<br />

null null<br />

Magnitudes as<br />

large as<br />

1.797610 308<br />

and as small as<br />

2.225010 -308 .<br />

Integers<br />

considered to<br />

have a range of<br />

2 31 –1 to –2 31 for<br />

computational<br />

purposes.<br />

Any sequence of<br />

zero or more<br />

characters.<br />

Decimal values<br />

(including exponent),<br />

hexadecimal, octal<br />

Single- or doublequote<br />

delimited<br />

undefined undefined<br />

(IE5.5+/NS6+/ECMA3)<br />

as a property of<br />

Global. Previously not<br />

available<br />

<strong>JavaScript</strong>/ECMAScript defines a select number of numeric constants, which are detailed in<br />

Table A-8. <strong>The</strong> Math object, discussed in Chapter 7 and Appendix B, also includes a variety of<br />

useful values such as Math.PI.<br />

Table A-8: Useful Numeric Constants<br />

Numeric Constant Description<br />

Infinity Infinity (property of Global)<br />

NaN Not a number (property of Global)<br />

Number.NEGATIVE_INFINITY Negative infinity<br />

Number.POSITIVE_INFINITY Positive infinity

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!