WTA: Basic Algorithm - Slice an Splice

hello all,

actually, i have been finished the task with the looping method, but there is something that makes me confuse…

before i using the looping method, i’ve been trying to use the conventional ways

here’s the code

 function frankenSplice(arr1, arr2, n) {
 // It's alive. It's alive! 
     let a = arr1.slice(0, arr1.length);
     let b = arr2.slice(0, arr2.length);
     b.splice(n, 0, a)
     return b
 }
 
 frankenSplice([1, 2], ["a", "b"], 1);

when i console.log the function, i getting the right result, but why i still get wrong??

When you run this code.

The expected output should be ["a", 1, 2, "b"]

but instead you are getting [ 'a', [ 1, 2 ], 'b' ]. You will need to remove this nested array.

Aaa, i get it…i have been wrong all this time :joy:
thank you for the response @shimphillip :grin: