Tell us what’s happening:
Hello, I’m trying to solve this Algorithm
As I understate the main problem is with this point
- All elements from the first array should be added to the second array in their original order.
But then I did not understand in what kind of order my solution added first arr1 to the secondary arr2?
Your code so far
function frankenSplice(arr1, arr2, n) {
// It's alive. It's alive!
let newArr = arr2.map(val=> val)
newArr.splice(n, 0, arr1)
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/73.0.3683.75 Safari/537.36
.
Link to the challenge: