If you're looking for terseness, then these will do the job, in addition to what you have:
user.email = (email) ? email : user.email;
email && user.email = email;
(your linter will probably complain)
I myself would choose something similar to @ibowankenobi. I use TypeScript, so it's even easier since it will generate the necessary JavaScript for configuring properties:
export class User {
private _email: string;
get email() { return this._email; }
set email(value: string) {
if (value) {
this._email = value;
}
}
}
const user = new User();
user.email = 'someone@email.com';
console.log(user.email) // someone@email.com
user.email = '';
console.log(user.email) // someone@email.com