My Profile
Gifts
Active Members
TodayLast 7 Days
more...
|
Array Object methods
This article explains about JavaScript Array Object methods
Methods
concat() Syntax: Array.concat(arrayName2, arrayName3, ..., arrayNameN)
Joins two or more arrays and returns the result .
join() Syntax : Array.join(separator) Puts all the elements of an array into a string. The elements are separated by a specified delimiter like ,
pop() Removes and returns the last element of an array .This will effect length of the array. Syntax: Array.pop()
push() Adds one or more elements to the end of an array and returns the new length. This will effect length of the arrary. Syntax: Array.push()
reverse() Reverses the order of the elements in an array Syntax: Array.reverse()
shift() Removes and returns the first element of an array Syntax: Array.shift() .This may effect length of the array.
slice() Returns selected elements from an existing array Syntax: Array.slice(begin[,end])
sort() This sorts the elements of an array Syntax: Array.sort(compareFunction)
splice() Removes and adds new elements to an array
toSource() Represents the source code of an object. This is inhertied from Object Syntax: Array.toSource()
toString() Converts an array to a string and returns the result . Syntax: Array.unshift(element1,..., elementN)
unshift() Adds one or more elements to the beginning of an array and returns the new length.This effects lengh of an array. Syntax: Array.unshift(element1,..., elementN)
valueOf() Returns the primitive value of an Array object. This is derived from Object Syntax: Array.valueOf()
|
|