• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Array Object

Array Object

Method Description Parameters
new Array(length ) Creates a new Array object. length , optional argument for array length
concat(array1 , ,arrayN ) Concatenates the specified values and returns a new array. array1,…,arrayN , the elements to be concatenated in a new array
join(separator ) Concatenates the elements of the array, inserts the separator between the elements, and returns a string. separator , a character or string
pop() Removes the last element in the array and returns the value of that element. 
push(value ) Adds elements to the end of the array and returns the new length. value , the elements to be added to the array
reverse() Reverses the order of elements in the array. 
shift() Removes the first element in the array and returns the value of that element. 
slice(indexA , indexB ) Returns a substring beginning with and including indexA and all the elements up to but not including indexB . indexA , the starting element (included) indexB , the ending element (not included)
sort() Sorts an array using the less-than (<) operator. Numbers are sorted in ascending order, and strings are sorted alphabetically. 
sortOn(fieldName ) Sorts the elements in the array based on a field in the array. fieldName , the field to be used for sorting
splice(index , count , elem1 , ,elemN ) Inserts or deletes elements from the array. index , the beginning of the insertion or deletion

count , the number of elements to be deleted

elem1,…,elemN , the elements to be inserted
toString() Returns a string with every element concatenated and separated by a comma. 
unshift(value ) Adds elements to the beginning of an array and returns the new length. value , the elements to be added to the array
Property Description
length Number of entries in the array.



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint