Slice and Splice: just a question

Tell us what’s happening:

Hey!

This splice() is a very mysterious thing.

Everything is fine and my
code works, but I confused with one moment.
Why if I want to return a statement immediately it returns an empty array:

...
  return arrNew.splice(n, 0, ...arr1);
  //returns []
...

but when I first do the statement and then return a result it returns correct things:

...
  arrNew.splice(n, 0, ...arr1);
  return arrNew;
  //returns [4, 1, 2, 3, 5]
...

Thanks for your answers!

Your code so far


function frankenSplice(arr1, arr2, n) {
  let arrNew = [...arr2];
  arrNew.splice(n, 0, ...arr1);
  return arrNew;
}

frankenSplice([1, 2, 3], [4, 5], 1);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/slice-and-splice/