Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js The equivalent of destructuring arrays and objects

// 1) assuming arr is [10, 20, 30, 40]
const first = arr[0];
const second = arr[1];
// third element skipped
const fourth = arr[3];

// 2)
const PI = Math.PI;
const E = Math.E;
const SQRT2 = Math.SQRT2;
Source by jscomplete.com #
 
PREVIOUS NEXT
Tagged: #js #The #equivalent #destructuring #arrays #objects
ADD COMMENT
Topic
Name
6+1 =