You are viewing a single comment's thread. Return to all comments →
class Polygon { constructor(sides) { this.sides = sides; } }
Polygon.prototype.perimeter = function() { let sum=0; this.sides.forEach(side=> sum += side); return sum; }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 4: Classes
You are viewing a single comment's thread. Return to all comments →
class Polygon { constructor(sides) { this.sides = sides; } }
Polygon.prototype.perimeter = function() { let sum=0; this.sides.forEach(side=> sum += side); return sum; }