Js USES the delete implementation to inherit the sample code
//Object impersonation method to implement js inheritancefunction A(color) {this.Acolor = color;this.AshowColor = function() {document.writeln("Acolor: " + this.Acolor);}}function B(color, name) {//Assign newMethod to A and call the constructor of Athis.newMethod = A;this.newMethod(color);//Then remove the reference to A so that he cannot be called laterdelete this.newMethod;this.Bname = name;this.BshowName = function() {document.writeln("Bname: " + this.Bname);}}var objA = new A("red");objA.AshowColor();document.writeln("----------------");var objB = new B("black", "demo");objB.AshowColor();objB.BshowName();document.writeln("----------------");