JSFiddle - React, Tailwind, and code Playground

by Fu-Ching Hsiao

JavaScript

function SetValues(v1,v2){
  this.v1 = v1;
  this.v2 = v2;
}
SetValues.prototype.getSize = function(){ 
  return this.v1 * this.v2;
}

function temp(v3){ SetValues.call(this,v3,v3); };

temp.prototype = SetValues.prototype;
temp.prototype.constructor = temp;


var a = new SetValues(2,3);
console.log(a.getSize());

var b = new temp(4);
console.log(b.getSize());