Day 4: Classes

Problem Link

Solution

classes.js
function Polygon(shape) {
  this.type = shape;
  this.perimeter = getPerimeter;
}

function getPerimeter() {
  return this.type.reduce((a, b) => a + b);
}

Last updated

Was this helpful?