Tell us what’s happening:
I managed to introduce the first array into the second in the correct order but I can’t figure it out how to remove the brackets/quotes.
Can I please get some help?
Your code so far
const frankenSplice = (array1,array2,index) => {
let arr1 = array1.slice();
let arrToString = arr1.toString();
let slicey = array2.slice();
let splicey = slicey.splice(index,0, arrToString)
return slicey
}
console.log(frankenSplice([1, 2, 3], [4, 5], 1))
console.log(frankenSplice([1, 2, 3, 4], [], 0))
console.log(frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2))
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:139.0) Gecko/20100101 Firefox/139.0
Challenge Information:
Implement the Slice and Splice Algorithm - Implement the Slice and Splice Algorithm
Welcome to the forum 
I see you are converting to a string at some point. Why is that?
If you have a string in an array, it will be in quotes.
I just tried to see if if the brackets get removed if I turn them to strings, didn’t work
Ok… it didn’t work and so you kept that in?
Also not 100% sure what you mean by “remove the brackets”?
Copy each element of the first array into the second array, in order, beginning at the given index, and return the resulting array.
Arrays are displayed with brackets, you wouldn’t “remove” them, but you do want to break apart and re-arrange the arrays.
HI @Omniscient !
Welcome to the forum!
There are few things you need to clean up in order to pass.
The first thing is here
you can remove this because it is not needed. Having it there is giving you the wrong result like this
[ 4, '1,2,3', 5 ]
[ '1,2,3,4' ]
Once you remove that, that leaves you having to figure out what really should go here for that 3rd argument
What you want to do is copy over each individual item from arr1
into that modifed slicey
array. My guess is that is why you were trying toString
in the first place.
I would suggest googling "how to insert all elements from copied array splice js"
or something to that affect.
You will get tons of results on how to get all of the individual elements from the copied array.
Once you fix those things, then it will pass.
Hope that helps
Thanks for the advices, I removed the unnecessary parts and I saw that I was missing to add “…arr1” to my code
2 Likes