jsinheritance
Install
npm install jsinheritance
Example
var Define = ; //Define Shape class as usually using prototype pattern var { thisposition = propertiesposition || x:0 y:0; }; //Define Shape class extends Object class ; Shapeprototype { return "I am a Shape at " + thisposition; }; Shapeprototype { thispositionx += x; thispositiony += y; }; //Define Rectangle class as usually using prototype pattern var { Rectangle; //Call super constructor thiswidth = propertieswidth; thisheight = propertiesheight; }; //Define Rectangle class extends Shape class and save super constructor //Important: this line must be after the constructor and before prototype functions definition Rectanglesuper = ; Rectangleprototype { return "I am a Rectangle!" + JSON; }; Rectangleprototype { return thiswidth * thisheight; }; //Define Square class as usually using prototype pattern var { //Transform the constructor arguments before calling the super constructor var parentProps = width: propertiessize height: propertiessize position: propertiesposition ; Square; //Call super constructor }; //Define Square class extends Rectangle class and save super constructor //Important: this line must be after the constructor and before prototype functions definition Squaresuper = ; Squareprototype { return "I am a Square!" + JSON; }; //Now create the instance of the objects var square = size: 100; var rect = width: 100 height: 200; console; // It prints the type of the object!! :) console; // It prints the type of the object!! :) rect; console;