In addition to what @Anon said:
The slice() method selects elements starting with a given starting argument and ending with, but does not include, the specified ending argument.
Example 1:
var fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"]; var citrus = fruits.slice(1, 3);
The result of citrus fruits will be:
Orange,Lemon
Example 2:
var fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"]; var citrus = fruits.slice(-3, -1);
The result of citrus fruits will be:
Lemon,Apple
Further information can be found here .
Luis Teijon Mar 30 '17 at 19:22 2017-03-30 19:22
source share