educative.io

How to add new properties to an instance object in javascript using destructuring operator

Can someone provide an example on how to add new properties to an instance object in javascript using destructuring operator.

// Employee data object with name and age
var employeeData = {
firsrName: ‘John’,
lastName: ‘Clare’,
age: 37
};

// Adding a property called company to the employeeData object
employeeData = { …employeeData, company: ‘Educative’ };