Answers for "which new es6 feature would you use to extract the properties of an object to local variables ?"

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

Code answers related to "which new es6 feature would you use to extract the properties of an object to local variables ?"

Code answers related to "Javascript"

Browse Popular Code Answers by Language