• code

    JavaScript EC6 Object Features

    Use Destructuring Assignment to Extract Values from Objects Destructuring assignment is special syntax introduced in ES6, for neatly assigning values taken directly from an object. So, it’s kinda turned around. Again, name would have a value of the string John Doe, and age would have the number 34. Here, the name and age variables will be created and assigned the values of their respective values from the user object. You can see how much cleaner this is. You can extract as many or few values from the object as you want. New variable names. You may read it as “get the value of user.name and assign it to a new variable named userName” and so on. The value of userName would be the string John Doe, and the value…