slice() is a function for extracting subsets of an array and adding them to a new array. Both the start and finish arguments are optional.
slice(start, end);
const alphabets = [ 'A', 'B' , 'C', 'D' ];
var newAlphabets = alphabets.slice(1, 3);
console.log(newAlphabets);
[ 'B', 'C' ]
const alphabets = [ 'A', 'B' , 'C', 'D' ];
var newAlphabets = alphabets.slice(-4, -1);
console.log(newAlphabets);
[ 'A', 'B', 'C' ]