This is in case you want to define properties of an object using existing variables.
let name = ‘Amy’;
let age = 28;
let person = { name, age }; // { name: ‘Amy’, age: 28 }
Note that the property’s name is the same as the existing variable’s name.
This is in case you want to define properties of an object using existing variables.
let name = ‘Amy’;
let age = 28;
let person = { name, age }; // { name: ‘Amy’, age: 28 }
Note that the property’s name is the same as the existing variable’s name.