//Use object impersonation to realize js inheritance
function A(color) {
= color;
= function() {
("Acolor: " + );
}
}
function B(color, name) {
// Assign newMethod to A and call A's constructor
= A;
(color);
//Then delete the reference to A, so that he cannot be called in the future
delete ;
= name;
= function() {
("Bname: " + );
}
}
var objA = new A("red");
();
("----------------");
var objB = new B("black", "demo");
();
();
("----------------");