...

/

Solution Review: Insert Elements

Solution Review: Insert Elements

This lesson will explain the solution to the problem in the previous lesson.

The challenge in the previous lesson requires you to fix the following code using your understanding of the .splice function.

Press + to interact
function solSplice(array1, array2, n) {
return array2.splice(n,0,array1)
}
console.log(solSplice([1, 2, 3],[4,5,6],1))
console.log(solSplice([8,9,10],[11,12,13],2))

Explanation

The original code has two issues that need fixing; let’s take a look at them one by one.

Issue 1

The first change we make is the ...

Access this course and 1400+ top-rated courses and projects.