JSFiddle - React, Tailwind, and code Playground
by Wentz Wu
JavaScript
function Person() {
this.id = 0;
this.sayHello = function() {
console.log("hello0");
return 0;
};
}
Person.prototype.sayHello = function() {
console.log("hello1");
return 1;
};
Person.prototype.sayHello2 = function() {
console.log("hello2");
return 2;
};
var alice = new Person();
alice.sayHello();
console.dir(Person);
console.dir(alice);
console.log(Person.prototype.sayHello === alice.__proto__.sayHello);
console.log(Person.prototype.sayHello());
console.log(alice.__proto__.sayHello());