Let’s say you want to write a single declaration that maybe has a property on it, based on some boolean expression. You can do that like so:

const hasAvatar = false;

const user = {
  firstName: 'martyn',
  ...(hasAvatar) && { avatar: 'link/to/some/avatar' },
};

Here, user is nothing other than:

{ firstName: 'martyn' }

But if you flip hasAvatar to true then it successfully evaluates to:

{ firstName: 'martyn', avatar: 'link/to/some/avatar' }

There are situations where the ability to one-liner an object declaration with conditional properties like this allows you to avoid moving around a lot of stuff you’d otherwise have to refactor. It’s definitely something worth keeping in your wheelhouse.