Been looking at arr.splice() but that does not seem to be what I'm after. Basically, I need to "splice" a range, ie:
let arr = [1,2,3,4,5,6,7,8,9,10];
I need to return a new array with either:
const newA = [1,2,3]
const newB = [4,5,6]
const newC = [7,8,9]
Surely arr.splice() can achieve the first and last but how to achieve something like newB
?
In plain english, "remove the first n
index and also the n
last index in the array (arr
) and give me the rest" which should be newB
.