Console gives me the same output but doesn't pass the tests

Hey code campers!
I’ve written code which by the look of it gives me the same output as the tests but it doesn’t pass the tests. Do you have any idea why?


function frankenSplice(arr1, arr2, n) {
const endof2 = arr2.slice(n); //get the tail to attach at the end
const startof2 = arr2.slice(0,n); //remove the tail
const result = startof2.concat(arr1); // add arr1
const result2 = result.concat(endof2); // add tail
console.log(result2);
return result;
}

//frankenSplice([1, 2, 3], [4, 5, 6], 1);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:95.0) Gecko/20100101 Firefox/95.0

Challenge: Slice and Splice

Link to the challenge:

You are logging out result2 but returning out result. Probably not what you want.

Edit: Just to be super clear. The test doesn’t care about what you log inside the function it is looking at what the function returns. So if result2 is correct then that is what you need the function to return.

1 Like

:smiley:
Classic! Thanks for spotting that!