JS Array - Slice vs Splice

Slice => copies a slice of the array and returns the copies slice (org. array remains unmutated)

Splice => plucks out(removes) a slice from the array and returns the remaining array, can also be used add elements to the array

For both:

start

Negative index counts back from the end of the array — if start < 0, start + array.length is used.


end

Negative index counts back from the end of the array — if end < 0, end + array.length is used.

Last updated