var n = array; array = array.slice(1);This piece of code is within a recursive function. I tried to rewrite these steps into one line, ultimately trying these two methods to directly modify the array (instead of slicing it):
var n = array.shift();and
var n = array.splice(0, 1);However, I do not get the same answer when using these methods, and I'm not sure why. Why would modifying the array directly (using shift or splice) be different than re-assigning it using array = slice(1)? Thanks!