JSFiddle - React, Tailwind, and code Playground

by Kaleb Hornsby

JavaScript

function Square(width, height) {
    var that = this;
    this.height = function(h){
        if(h != null) height = h;
        return height;
    };
    this.height.valueOf = function(){
        return that.height();
    };
    this.width = function(w){
        if(w != null) width = w;
        return width;
    };
    this.width.valueOf = function(){
        return that.width();
    };
}
var s = new Square(1,2);
console.log(s.height);
s.height(5);
console.log(s.height);
var h = s.height;
console.log(h);