Quick actions

cmd+k|ctrl+k

Navigation

Languages

Array Destructing

Snippet info

Language

JavaScript

Visibility

public

Author

sanjivrai543

Created

2020-10-27T23:45:05Z

Updated

2020-10-27T23:45:05Z

console.log("Hello World!");
//to pull values from array

const names=['Anna','Mariam','Joe','Mark','Matt'];

//for every member we have to create a variable whic is long
//const anna=names[0];

//therefore we can use array destruction
//const [anna,mariam,joe,...restofnames]=names;


//console.log(`${anna} ${mariam} ${joe} ${restofnames}`);

const [...allnames]=names;
console.log(`${allnames}   ${allnames.length}`);
INFO