JSFiddle - React, Tailwind, and code Playground
by vikikamath
JavaScript
/* Constructor */
function User(name, passwordHash){
this.name = name;
this.passwordHash = passwordHash;
}
User.prototype.toString = function(){
return "[User"+ this.name + "]";
};
User.prototype.checkPassword = function(password){
return hash(password) === this.passwordHash;
};
var u = new User("abc", "0eff33ae"); // new instance of user
console.log(user.__proto__);
console.log(User.prototype); //User { toString=function(), checkPassword=function()}
console.log(u.__proto__); //User { toString=function(), checkPassword=function()}
console.log(Object.getPrototypeOf(u)); //User { toString=function(), checkPassword=function()}