Published in : 2022-03-05
I want to rename the key from the object.
Previously I was using ‘email’ key everywhere in all JSON responses, I want to change the email key to ‘username’.
obj[ username ] = obj[ email];delete obj[ email];
Can you please tell me what is the optimized way to do it? I feel low confident while deleting object key in above way!
Join our community and get the chance to solve your code issues & share your opinion with usSign up Now