JSFiddle - React, Tailwind, and code Playground

JavaScript

function myGeometryObject(r, x, y){
    
    this.r = r;
    this.x = x;
    this.y = y;
    
    var OBJ = this;
    
    this.returnArea = function(){
        return 'wrong override';
    }
}

function myRectangle(r, x, y){
    myGeometryObject.call(this, r, x, y);
}
myRectangle.prototype = new myGeometryObject();

myRectangle.prototype.returnArea = function(){
    return 'right override';
}
var rectangle = new myRectangle(0, 5, 5);
alert(rectangle.returnArea());