Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Destructuring assignment JS

const [firstElement, secondElement] = list;
// is equivalent to:
// const firstElement = list[0];
// const secondElement = list[1];

// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #Destructuring #assignment #JS
ADD COMMENT
Topic
Name
6+2 =