8. Declaring Objects Shorthand

PHOTO EMBED

Fri Mar 05 2021 20:00:18 GMT+0000 (UTC)

Saved by @w_jellett

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.
content_copyCOPY

https://javascript.plainenglish.io/15-simple-coding-techniques-to-get-your-tasks-done-with-shorter-code-in-javascript-59d46801db0