I want to return the password of a user's account if they have a password. If not I want it to return undefined.
EDIT: The user is an account holder for a website, the password is the password to gain entry to their account.
My attempt:
function retrievePassword(user) {
if (user = password) {
return password;
} else {
return '';
}}
I believe my problem lies in the secound line. I want to say if the user CONTAINS or HAS or POSSESES a password, then return it. I am sure that user = password is not communicating that, but I haven't a clue how you are supposed to say that.