Skip to content

Instantly share code, notes, and snippets.

@brianyang
Last active August 29, 2015 14:11
Show Gist options
  • Save brianyang/3096f0e0cf37f697ab1f to your computer and use it in GitHub Desktop.
Save brianyang/3096f0e0cf37f697ab1f to your computer and use it in GitHub Desktop.
function User(name, passwordHash){
if (!(this instanceof User)){
return new User(name, passwordHash)
}
this.name = name
this.passwordHash = passwordHash
}
}
function User(name, passwordHash){
var self = this instanceof User ? this : Object.create (User.prototype);
self.name = name;
self.passwordHash = passwordHash;
return self;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment