Next page | Contents page |


Numbers can be integers or floating point. There are not separate types for these, we can simply give numeric values to any variables.


Remember that E (or e) means "times 10 to the power of".

Range: +/- Number.MIN_VALUE .. Number.MAX_VALUE (approx +/- 5.0E-324 .. 1.79E+308)

Accuracy: 64-bit IEEE-754 standard, giving just over 19 decimal digits. (See the ECMAScript standard for precise details.)

If the result of an operation which should yield a number cannot be represented as a number, the variable gets special value Number.NaN (not a number). As a shorthand you can code that simply as NaN.

There are also special values Number.NEGATIVE_INFINITY and Number.POSITIVE_INFINITY and again there are shorthand notations: +Infinity and -Infinity.

Note that all of this is platform-independent: an advantage over some other languages.

Next page | Contents page |