JSFiddle - React, Tailwind, and code Playground
JavaScript
//Inheritance
function Point(x, y) {
this.x = x;
this.y = y;
this.dist = function () {
return Math.sqrt((this.x*this.x)+(this.y*this.y));
};
this.toString = function () {
return "("+this.x+", "+this.y+")";
};
}
var p = new Point(3, 1);
// alert(p instanceof Point);