lets create one object so we can run and test it.
The will be as follows:
Now we can remove the object property from the following ways:
Using delete operator:
as we have seen the user’s object now before sending to frontend we will delete the password property and then we will send it.
delete user.password; >>true
Or alternatively, you can do the following way as well.
delete user['password']; >>true
If delete won’t work then you can use the following:
Please let me know if it won’t work.