Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript Nested Destructuring Assignment

// nested array elements
const arrValue = ['one', ['two', 'three']];

// nested destructuring assignment in arrays
const [x, [y, z]] = arrValue;

console.log(x); // one
console.log(y); // two
console.log(z); // three
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #Nested #Destructuring #Assignment
ADD COMMENT
Topic
Name
4+7 =