How to conditionally adding a key-value pair in object ?

How to conditionally adding a key-value pair in object ?

When initializing a new object in JavaScript, you can efficiently add a key-value pair conditionally by utilizing the concise and expressive nature of the conditional operator.

βœ… For more tips & tricks on javascript learn from below website
πŸŽ‰πŸŽ‰ https://fullstackindepth.com/ πŸŽ‰πŸŽ‰

Β