First we use a functional object constructor to create a Shape class with the properties x and y. We then use the prototype keyword to add a getx method to the Shape object. Then we create a Circle class. We use the prototype keyword to make the Circle class inherit the getx method of the Shape class.
After creating the Circle class, we use the prototype keyword to add the gety method to the Circle class. We then create an instance of the Circle object named circle1, initializing it with x=10 and y=12.
The last line of the code displays the values of x and y using circle1's getx method that it inherited from the Shape object, and using circle1's gety method that we added directly to the circle1 object.
Learn more at amazon.com