HTML and CSS Reference
In-Depth Information
Boolean Object
The Boolean object converts other objects to Boolean values. A value of False is
returned for values of undefined, null, 0, -0, false, NaN, or an empty string (""). All other
values return a value of True. Table G-25 summarizes the methods for the Boolean object.
Table G-25 Boolean Object
Method
Function
toSource
Returns a string representing the source code of an object; you can use this
value to create a new object. It overrides the Object.toSource method.
toString
Returns a string representing the specified object. It overrides the Object.
toString method.
Array Object
An array is an ordered set of values associated with a single variable name.
Table G-26 summarizes the properties and methods for the Array object.
Table G-26 Array Object
Property
Description
index
For an array created by a regular expression match, the zero-based index of the
match in the string
input
For an array created by a regular expression match, reflects the original string
against which the regular expression was matched
length
Reflects the number of elements in an array; can be changed to truncate or
extend array
Method
Function
concat()
Joins two arrays and returns a new array
join()
Joins all elements of an array into a string
pop()
Removes the last element from an array and returns that element
push()
Adds one or more elements to the end of an array and returns the new length
of the array
reverse()
Transposes the elements of an array; first array element becomes the last and
the last becomes the first
shift()
Removes the first element from an array and returns that element
slice()
Extracts a section of an array and returns a new array
sort()
Sorts the elements of an array
splice()
Adds and/or removes elements from an array
toLocaleString()
Returns a string representing the array and its elements
toSource()
Returns an array literal representing the specified array; use this value to create a
new array as it overrides the Object.toSource method
toString()
Returns a string representing the array and its elements; overrides the
Object.toString method
unshift()
Adds one or more elements to the front of an array and returns the new length
of the array
Search WWH ::




Custom Search