HTML and CSS Reference
In-Depth Information
JavaScript Element
Description
Number
An object representing a numeric value; created using the object constructor
new Number(
value
)
where
value
is the initial value of the object
Properties
MAX_VALUE
The largest representable value
MIN_VALUE
The smallest representable value
NaN
A Boolean indicating if the object is not a number
NEGATIVE_INFINITY
A Boolean indicating if numeric overflow occurred due to a calculation of nega-
tive infinity
POSITIVE_INFINITY
A Boolean indicating if numeric overflow occurred due to a calculation of posi-
tive infinity
Methods
toExponential(
digits
)
Returns a text string of the number in exponential notation with
digits
digits after
the decimal place
toFixed(
digits
)
Returns a text string of the number with
digits
digits after the decimal place
toLocaleString()
Converts the number to a text string according to local conventions
toPrecision(
precision
)
Returns a text string of the number where
precision
is the number of significant digits
toString()
Converts the number to a text string
valueOf()
Returns the numeric value of the number
Object
A general class of JavaScript objects created using one of the following
constructors
new Object()
new Object(
value
)
where
value
is an optional argument that specifies a Boolean, numeric, or
string value for the object
Properties
constructor
The JavaScript function that constructed the object
Methods
create(
prototype
)
Creates and returns a new object based on
prototype
defineProperties(
object
,
descriptors
)
Creates or configures for
object
the properties named and described in
descriptors
defineProperty(
object
,
name
,
descriptor
)
Creates or configures
object
, where
name
is the name of a property and
descriptor
is the property descriptor
freeze(
object
)
Makes
object
non-extensible and all of its properties non-configurable so that new
properties cannot be added to
object
and existing properties cannot be configured
getOwnPropertyDescriptor
(
object
,
name
)
Returns a property descriptor for
object
where
name
is the name of the property
getOwnPropertyNames(
object
)
Returns an array containing the names of all non-inherited properties of
object
getPrototypeOf(
object
)
Returns the prototype of
object
isExtensible(
object
)
Returns a Boolean value indicating whether
object
can have new properties added
to it
isFrozen(
object
)
Returns a Boolean value indicating whether all of the non-inherited properties of
object
are read-only
isPrototypeOf(
object
)
Returns a Boolean value indicating whether the object is a prototype of
object
isSealed(
object
)
Returns a Boolean value indicating whether new properties can be added or exist-
ing properties can be deleted from
object