I recently spent a few hours trying to understand why my array was changing when using the splice method. I thought I’d save you some time and outline what I learned.
For Those of You Short on Time
Splice edits the original array!
// edit original array
x=[1,2,3]
x.splice(2)
console.log(x)
[1,2]