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: