Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I got confused in math formulas #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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