Skip to content

Latest commit

 

History

History
13 lines (9 loc) · 361 Bytes

File metadata and controls

13 lines (9 loc) · 361 Bytes

Introduction

JavaScript's array destructuring syntax is a concise way to extract values from an array and assign them to distinct variables.

In this example, each value in the numberOfMoons array is assigned to its corresponding planet:

const numberOfMoons = [0, 2, 14];
const [venus, mars, neptune] = numberOfMoons;

neptune;
// => 14