Array destructuring in JavaScript
When we have an array and we want to extract the variables we can do it like this:
const fruits = ['apple', 'strawberry', 'banana', 'orange'];
const apple = fruits[0] // apple
const strawberry = fruits[1] // strawberry
const banana = fruits[2] // ...
blog.mariobarcelo.dev2 min read