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)