HTML and CSS Reference
In-Depth Information
The type number represents floating point numbers with zero or more decimal places. There are
no separate types for concepts such as integers, long integers, singles, doubles, or bytes. One special
number, NaN , is reserved for numbers that don't make mathematical senseā€”it is a variable that
contains the result of a math operation that makes no sense. In fact, the name NaN is the acronym of
Not-A-Number. The built-in Number object just wraps a primitive numeric value and adds a method
to convert the number to a string.
The type string represents a sequence of zero or more characters. The content of a string is
bracketed in matching pairs of single or double quotes. The built-in String object adds a few methods,
including substring, which extracts a segment of the string between two specified indexes, and
toLowerCase , which converts characters in the string to lowercase.
Table 4-1 summarizes other built-in objects.
TABLE 4-1 JavaScript built-in objects
Built-in object
Description
Supplies a rich programming interface for a collection of JavaScript objects. You
can access members by index and also add and remove existing elements.
Array
Supplies a variety of handy methods to work with a date, including getting and
setting individual elements such as day, month, or year. It also works to deal with
time information.
Date
Supplies an interface to perform a variety of mathematical tasks ranging from
getting random numbers to power, and from rounding to min/max and absolute
value functions.
Math
Supplies regular expressions.
RegExp
The JavaScript global object
All JavaScript objects inherit from a unique global super object, and subsequently, properties and
functions of the global object augment all native and custom objects. In particular, the global object
features the following properties:
NaN, which returns the value for Not-A-Number.
Infinity, which returns the value for infinity.
Table 4-2 lists the functions available on the global object.
 
Search WWH ::




Custom Search