A class hierarchy keeps its shape in JavaScript: a derived object goes wherever its base class is expected.
Circle and Square derive from Shape, whose area is virtual. largerArea takes two Shape references; handed a Circle and a Square, each call to area() runs that class's own code, as it would in C++.
A class binds with one base; a second base class is left out. The hierarchy itself stays in C++: a JavaScript class cannot extend Shape to override its methods.
Try it
Find the radius at which the circle becomes the larger of the two.