Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions geom.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,53 @@ 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){
this.sideA = sideA;
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){
Expand Down