You are viewing a single comment's thread. Return to all comments →
Javascript solution using reduce() method:
class Polygon { constructor(sidesArray) { this.sides = sidesArray; } perimeter() { const result = this.sides.reduce((accumulator, currentValue) => accumulator + currentValue); return result; } }
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 →
Javascript solution using reduce() method: