...

/

Solution Review: Array Destructuring

Solution Review: Array Destructuring

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

Solution #

Press + to interact
function removeFirstTwo(list) {
const [, , ...arr] = list;
return arr;
}
var arrLiteral = [8,9,10,11,12]
console.log("arr contains: " + removeFirstTwo(arrLiteral))

Explanation #

The solution to this is straightforward. Let’s go over it in detail and start by discussing the array destructuring syntax.

The following is an array literal: ...

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