From 6f8ce9084a9515ce60019a5cdc21e303b011d714 Mon Sep 17 00:00:00 2001 From: Salem Alshehri Date: Mon, 4 Feb 2019 21:45:04 +0300 Subject: [PATCH 1/2] Rectangle completed!! --- geom.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/geom.js b/geom.js index d942747..5fdb54c 100644 --- a/geom.js +++ b/geom.js @@ -3,8 +3,30 @@ class Rectangle { this.length = length; this.width = width; } + get isSquare(){ + if (this.height === this.width){ + return true; + } + } + get calcArea(){ + return this.height * this.width; + } + + get perimeter(){ + return 2 * (this.height + this.width); + } + } +const resultSquare = new Rectangle (4, 4); +console.log(resultSquare.isSquare) + +const result = new Rectangle(3, 4); +console.log(result.calcArea) + +const resultPer = new Rectangle(3, 4); +console.log(resultPer.perimeter) + class Triangle { constructor(sideA, sideB, sideC){ From 3dc6be2187f7c37333a11ea4a6554789a975f068 Mon Sep 17 00:00:00 2001 From: Salem Alshehri Date: Mon, 4 Feb 2019 23:01:27 +0300 Subject: [PATCH 2/2] The first two of Triangle --- geom.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/geom.js b/geom.js index 5fdb54c..5f2165b 100644 --- a/geom.js +++ b/geom.js @@ -34,8 +34,22 @@ class Triangle { this.sideB = sideB; this.sideC = sideC; } + get isEquilateral(){ + if (this.sideA === this.saidB & this.sideA === this.sideC) + return true; + } + get isIsosceles(){ + if (this.sideA === this.sideB & this.sideA !== this.sideC) + return true; + } } +const resultIso = new Triangle (2,2,3); +console.log(resultIso.isIsosceles) + +const checkIsEqu = new Triangle (3, 3, 3); +console.log(checkIsEqu.isEquilateral) // I got undefined on this + class LineSegment { constructor(x1, y1, x2, y2){