JSFiddle - React, Tailwind, and code Playground
by hong owen
JavaScript
var Cat = function(){
this.Color = "black";
this.Eat = function(){
alert("吃老鼠");
};
}
Cat.prototype.A = function(){
alert("Cat A");
};
Cat.prototype.B = function(){
alert("Cat B");
};
var Dog = function(){
this.Weight = "30";
}
var Fn = function(){};
Fn.prototype = Cat.prototype;
Dog.prototype = new Fn();
Dog.prototype.constructor = Dog;
console.log(Dog.prototype.constructor == Dog); // true
console.log(Cat.prototype.constructor == Cat); // true
var dog1 = new Dog();
dog1.A(); // Cat A
dog1.B(); // Cat B
dog1.Eat();//has no method 'Eat'