#javascript #arrays #javascriptarrays #arrayslice #slicemethod
I want to take a part of elements from an array and generate a new array with them.
I used slice method but nothing has changed. b.slice(1, 3);
Because the slice method does not modify the original array.
But the slice method returns a new array.
Let's use this feature and generate a new array.
const a = b.slice(1, 3);