My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

What is the best way to mutate an object?

Ashish Kumar's photo
Ashish Kumar
·Feb 20, 2018

For example: If I have something like user.email = email || user.email

I have to update the email property of user if email exists, otherwise leave it untouched.