Why i can't pass the challange? - My output is correct!

Tell us what’s happening:

Your code so far

function frankenSplice(arr1, arr2, n) {
var arr2Copy = arr2.slice();
for(var i=0; i<arr1.length; i++){
  arr2Copy.splice(n, 0, arr1[i]);

frankenSplice([1, 2, 3], [4, 5], 1);
frankenSplice([1, 2], ["a", "b"], 1);
frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2)

Your browser information:

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

Challenge: Slice and Splice

Link to the challenge:

Return your function:

return arr2Copy;
1 Like

Thank you so much! :slight_smile:

Never use var, unless you’re working with legacy code & there’s no other option.

Either use let or const.

1 Like