You are viewing a single comment's thread. Return to all comments →
My answer:
function Rectangle(a, b) { this.length = a; this.width = b; this.area = a * b; this.perimeter = 2 * (a + b); }
or with ES6 (but without usage of defined code in problem):
class Rectangle { constructor(a, b) { this.length = a; this.width = b; this.area = a * b; this.perimeter = 2 * (a + b); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 4: Create a Rectangle Object
You are viewing a single comment's thread. Return to all comments →
My answer:
or with ES6 (but without usage of defined code in problem):