Shorthand Assignment Notation

Write { name } for { name: name }, and [expression] to compute a key. Spread ... in a literal copies own enumerable properties; later keys win, so put defaults first. Spreading false adds nothing, which makes conditional properties a one-liner. console.log({ name, born }) is a handy labeled debug print.

Property shorthand, computed keys and spreadJavaScriptLive
const name = "Ada", born = 1815, field = "lang";
const person = { name, born, [field + "Count"]: 3 };
const defaults = { theme: "light", fontSize: 14 };
const settings = { ...defaults, theme: "dark", ...(born > 1800 && { vintage: true }) };
console.log(person, settings);