which of this approach is better?

1)
const { password, ...userWithoutPassword } = user;
return userWithoutPassword


2)
delete user.password;
return user
Was this page helpful?