Tell us what’s happening:
This is the code I have created. Do the experts have any advice on my code so that I improve..
Your code so far
function frankenSplice(arr1, arr2, index){
const newArr = [];
let i = 0;
let fake2 = [...arr2];
for(; i < index; i++){
}
let fake1 = arr2.slice(0,i);
newArr.unshift(...fake1);
newArr.push(...arr1)
fake2.splice(0,i);
newArr.push(...fake2);
console.log(newArr);
return newArr
}
frankenSplice([1,2,3], [4,5], 1)
frankenSplice([1, 2], ["a", "b"], 1);
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/142.0.0.0 Safari/537.36
Challenge Information:
Implement the Slice and Splice Algorithm - Implement the Slice and Splice Algorithm