The function does not work: it doesn’t return anything. console.log
just prints values to the console to help developers debug their code.
If you fix the above, the function still will not work because you’ve missed two requirements:
…copy each element of the first array into the second array, in order.
It isn’t saying put arr1 into arr2, it’s saying put the individual values of arr1 into arr2. You are just putting one value, arr1, into arr2, not what arr1 contains.
The input arrays should remain the same after the function runs
splice
mutates, so you are modifying the arrays directly, & it is a requirement that you don’t do that.