let subArray = array.slice(startIndex, endIndex)
// ['a', 'b', 'c'].slice(0, 2) === ['a', 'b']
const ar = [1, 2, 3, 4, 5];
// slice from 1..3 - add 1 as the end index is not included
const ar2 = ar.slice(1, 3 + 1);
console.log(ar2);
let subArray = array.slice(startIndexInclusive, endIndexExclusive)
let subArray = array.slice(startIndex, endIndex)
// endIndex is optional, if ommited it will go to the end of the array.