Home Array Object Array.join() String Object

3.2.10.12 Array.slice()

newArray = array.slice(begin, [end]);

Returns a section of the array as a new array. The section is defined by the parameters begin and end:

Example:

var test = new Array("yellow", "green", "red", "blue");
part = test.slice(1, 3);

// part.length is 2
// part[0] is "green"
// part[1] is "red"
// "test" is not changed

See also: Array.splice()


Home Array Object Array.join() String Object

Search

Latest news from the Forum