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";
}
Dog.prototype.testDog = function(){
alert("test Dog");
}
var extend = function(Child,Parent){
var p = new Parent();
var c = Child.prototype;
for (var i in p) {
c[i] = p[i];
}
c.uber = p;
}
extend(Dog,Cat);
var dog1 = new Dog();
dog1.A();
dog1.Eat();
dog1.testDog();
alert(dog1.Weight);