I have been trying to figure something out. I did a bit of research after struggling through the Slice and Splice basic algorithm and scripting challenge because of something seemingly simple.
Why does splice return an empty array if in console.log() or the return statement?
ex.
a1 = [1, 2, 3];
a2 = [4, 5, 6];
console.log(a1.splice(1, 0, ...a2));
// returns []
where as running splice outside of console.log() or return statement returns the desired result.
a1 = [1, 2, 3];
a2 = [4, 5, 6];
a1.splice(1, 0, ...a2)
console.log(a1);
// returns [ 1, 4, 5, 6, 2, 3 ]