So I’ve used the solution in the hint section and it passes. I’ve also used the below code using the spread operator on the splice(’…arr1’ instead of just ‘arr1’) and it passes.
Which would be fine but the below code gives the exact same console log as they do and it matches the stated correct answer for every check but doesn’t pass them.
For example, all 3 code blocks log:
head,shoulders,claw,tentacle,knees,toes
for the example in the code but only the below code fails that check.
Is there an ‘under the hood’ difference I don’t understand yet? or have I just missed something obvious?
Thanks
Edit: I’ve also used ‘typeof’ to make sure its an object.
Your code so far
function frankenSplice(arr1, arr2, n) {
let arp2 = []
arp2 = arr2.slice();
arp2.splice(n,0,arr1);
return arp2;
}
console.log(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/75.0.3770.142 Safari/537.36
.
Link to the challenge: