JSFiddle - React, Tailwind, and code Playground
by Mufasaa
JavaScript
function Shape(name, edges) {
this.Name = name;
this.Edges = edges;
}
Shape.prototype.toString = function(){ return "Shape: " + this.Name;};
//create the circle
function Circle(radius) {
this.Radius = radius;
this.Area = function(){ return Math.PI * Math.pow(this.Radius, 2);};
}
Circle.prototype = new Shape("Circle", 1);
Circle.prototype.constructor = Circle;
var circle = new Circle(5);
console.log(circle);
console.log(circle.toString());
console.log(circle.Area);