Javascript Object Destructuring
Why we need object destructuring? Object destructuring is required to extract object properties so that we can use it in a simpler way and don't need to tap into the values of object. Basic Object Destructuring Object destructuring use value of properties without using dot notation , which makes the code easy to write and makes the code smaller. When we extract the value from the object , the key and name of the variable in which the property value will be there must be same or else it will throw the error of undefined. Using a new variable name We can also rename the variable name by colon , and use the value of property in the different name of the variable , this cannot be done in array destructuring as we can variable with anything , so it would be not needed. Variables declared before assigned When you are destructuring in the object , you need to use the same variable as the keys in the object as to proper destructor the array and wrap the entire expression into t...