Answers for "destructuring assignment syntax"

8

object destructuring

const book = {
    title: 'Ego is the Enemy',
    author: 'Ryan Holiday',
    publisher: {
        name: 'Penguin',
        type: 'private'
    }
};

const {title: bookName =  'Ego', author, name: {publisher: { name }} = book, type: {publisher: { type }} = book } = book;
Posted by: Guest on March-18-2020
0

Destructing variable assignment

let profile = ['bob', 34, 'carpenter'];let [name, age, job] = profile;console.log(name);--> 'bob'
Posted by: Guest on July-24-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language