Slice and Splice Test Not Passing When Output Appears to be Correct

Slice and Splice Test Not Passing When Output Appears to be Correct
0

#1

Tell us what’s happening:

I’m not sure what I’m missing on this challenge.

When I log results to the console, it’s what the test is expecting, but it won’t pass. ??

Example
frankenSplice([1, 2], [“a”, “b”], 1);
logs: a,1,2,b

But the test still fails.

Your code so far


function frankenSplice(arr1, arr2, n) {
  // It's alive. It's alive!
  let result = arr2.slice();
  result.splice(n, 0, arr1);
  console.log(result);
  return result;
}

frankenSplice([1, 2], ["a", "b"], 1);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36.

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


#2

Not quite. For test case 1, you are returning

[ 4, [ 1, 2, 3 ], 5 ] instead of [4, 1, 2, 3, 5]


#3

If you need another hint, go back and look at the spread operator (if you know what is).


#4

Ah! Thanks for the hint.