Answers for "array destructuring mdn"

5

array destructuring

//Without destructuring

const myArray = ["a", "b", "c"];

const x = myArray[0];
const y = myArray[1];

console.log(x, y); // "a" "b"

//With destructuring

const myArray = ["a", "b", "c"];

const [x, y] = myArray; // That's it !

console.log(x, y); // "a" "b"
Posted by: Guest on January-18-2021
5

destructure array javascript

var [first, second, ...rest] = ["Mercury", "Earth", ...planets, "Saturn"];
Posted by: Guest on May-31-2020
1

array destructuring in javascript

const array = ['ismail', 'sulman'];
// array destructuring
const [firstElement, secondElement] = array;
console.log(firstElement, secondElement);
const secondArray = ['ismail', 'naeem', 'Mr', 1];
const [firstEl, secondEl, ...array1] = secondArray;
console.log(firstEl, secondEl, array1);
Posted by: Guest on December-12-2020
0

array destructuring mdn

eslint use array destructuring
Posted by: Guest on July-02-2021

Browse Popular Code Answers by Language