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 h.daily-dev-tips.com #
 
PREVIOUS NEXT
Tagged: #javascript #Nested #Destructuring #Assignment
ADD COMMENT
Topic
Name
7+2 =