# Nested FOR Slice and Splice - "not in original order"

To my knowledge push method does not mutate original string. Any advise on what is wrong is welcome:

function frankenSplice(arr1, arr2, n) {
var blah=[];
for (let i=0; i<arr2.length; i++){
if(i==n){
for (let j=0; j<arr1.length; j++){
blah.push(arr1[j]);
}
}
blah.push(arr2[i]);
}
return blah;
}

console.log(frankenSplice([1, 2, 3], [4, 5, 6], 1));
console.log(frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2));

This is the link of the exercise: https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-algorithm-scripting/slice-and-splice

The tests are poorly worded. It’s actually expecting that you use the splice method.

Same issue with slice and splice:

function frankenSplice(arr1, arr2, n) {
// It's alive. It's alive!
var arr3=arr2.slice();

for(let i=0; i<arr3.length; i++){
if (n==i){
for(let j=arr1.length-1; j>=0; j--){
arr3.splice(n,0,arr1[j]);
}
}
}
return arr3;
}

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

What would be wrong now?

It looks like your code doesn’t output the correct result for the specific case where arr2 is empty and n is 0. frankenSplice([1,2,3,4], [], 0) should produce [1,2,3,4], but in your case it produces [].