Skip to content

Commit

Permalink
fix: lesson_06 converted function into a const
Browse files Browse the repository at this point in the history
  • Loading branch information
txtran224 committed Oct 7, 2024
1 parent ec82617 commit a6f1c00
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lesson_06/expression/src/expression_calculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ export class ExpressionCalculator {
calculate(a: number, b: number, c: number, d: number, e: number): number {
// Implement your code here to return the correct value.

return this.divide(this.multiply(this.add(a, b), c), this.pow(d, e));
const ab = this.add(a, b);
const abc = this.multiply(ab, c);
const de = this.pow(d, e);
const answer = this.divide(abc, de);
return answer;
}

add(a: number, b: number): number {
Expand All @@ -22,7 +26,6 @@ export class ExpressionCalculator {
return Math.pow(base, exponent);
}
}

/* onst add = a + b;
const multiply = add * c;
const divide = multiply / this.pow(d, e);*/
Expand Down

0 comments on commit a6f1c00

Please sign in to comment.