Im getting the right answer but its still saying false

Tell us what’s happening:
Describe your issue in detail here.

   **Your code so far**
   I get the right answer, but its still not passing. when I console.log inputArr it returns three arrays, I believe thats why its not passing, but I dont know why its returning three arrays and why its not passing.

function frankenSplice(arr1, arr2, n) {
 //copy the elements of the first array
 //into the second array at the n position
let inputArr = arr2.slice('');
for(const item of arr1){

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

User Agent is: Mozilla/5.0 (X11; CrOS aarch64 14469.41.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.57 Safari/537.36

Challenge: Slice and Splice

Link to the challenge:

Is it meeting the requirements?

Try this at the end:

console.log(frankenSplice([1, 2, 3], [4, 5], 1));

That should reveal the problem.

I was able to add one line to your code and get it to pass.

1 Like

Is it something I’m not incrementing?

I got I was returning the inputArr in the wrong place, thank you for the help though!

I don’t see that you were ever returning it - but I’m glad you figured it out. (I wish I had a nickel for every time I made that same mistake.)

1 Like

Yeah you’re right I was console.logging it first and then I had to remove that and return it below the loop, and that’s true those little things will always get you

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.