This section provides a list of commonly used array object instance methods including split(), join(), sort(), etc.
As an object, an array has several commonly used object instance methods:
this_array.concat(second_array) - The concat() method returns a new array
by concatenating the specified second array to the end of this array.
this_array.join(delimiter) - The join() method returns a string
by joining all elements in this array with the specified delimiter.
this_array.pop() - The pop() method returns the last element of this array
and removes it from this array reducing the array length by 1.
this_array.push(exp1, exp2, ...) - The push() method adds specified expressions
as array elements to the end of this array and returns the last element added.
this_array.reverse() - The reverse() mothod reverses positions of all elements in this array.
this_array.shift() - The shift() method returns the first element of this array,
and removes it from this array reducing the array length by 1.
this_array.unshift(exp1, exp2, ...) - The unshift() method adds specified expressions
as array elements to the front of this array and returns the new length of the array.
this_array.slice(start_index, upto_index) - The slice() method returns a section of this array
between the specified indexes.
this_array.splice(index, len, [exp1, exp2, ...]) - The splice() method removes "len" number of elements
from this array starting at the specified index. If optional expressions are specified, they will be
added at the specified index.
this_array.sort() - The sort() method sorts all elements in alphabetic ascending order
in this array.
this_array.indexOf(exp) - The indexOf() method returns the index of the first element that
matches the specified expression in this array. If no matches found, -1 will be turned.
The indexOf() method is supported only in JavaScript 1.6 and higher.
this_array.lastIndexOf(exp) - The lastIndexOf() method returns the index of the last element that
matches the specified expression in this array. If no matches found, -1 will be turned.
The lastIndexOf() method is supported only in JavaScript 1.6 and higher.
A tutorial example will be given in the next section showing examples of using array object methods.