DEV Community

snangunurikrishna
snangunurikrishna

Posted on

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.

Image description

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

Top comments (0)