array slice documentaiotn code example
Example 1: js slice
const arr=[1,2,3,4,5];
const slicedArr = arr.slice(1,4); // slicedArr = [2,3,4]
Example 2: splice from array
let myFish = ['angel', 'clown', 'mandarin', 'sturgeon']
let removed = myFish.splice(2, 0, 'drum')
// myFish is ["angel", "clown", "drum", "mandarin", "sturgeon"]
// removed is [], no elements removed