Tell us what’s happening:
Yes, I cheated and used hints- spoiler, However I tried to tweak a little and see if things work. Splice and slice in the same line did not work whereas below code gave me the same result as challenge is asking for. But the code does not pass the challange. Why? please someone clear my doubt on both cases. Thanks in advance for any input.
Your code so far
function frankenSplice(arr1, arr2, n) {
// It's alive. It's alive!
let localArray = arr2.slice(0, 100);
localArray.splice(n,0,[...arr1]);
return localArray;
}
console.log(frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/slice-and-splice/