Skip to content

Commit b155724

Browse files
author
AmiyahJo
committed
function but they're not working
1 parent 84730fb commit b155724

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

lesson_06/expression/src/expression_calculator.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,26 @@ export class ExpressionCalculator {
66
//PEMDAS order -> expected : //((a + b) * c) / d^e
77

88
// Caculate addition with an add function '(a + b)'
9-
function Add(a,b){
10-
let addition = a + b;
11-
};
9+
const originalSum = you.add(a,b);
1210
// caculate multiplication '(add * c)' and 'd^e' so d * (e times)
13-
11+
const multiply = you.multiply(originalSum, c)
1412
// caculate division with divide function which is different variables of the multiplication values '(add * c)' and 'd^e' so d * (e times)
15-
13+
const lastOne = you.divide(multiply, d^e)
1614
return 0;
1715
}
1816

17+
function add(a: number , b: number){
18+
return a + b;
19+
}
20+
21+
function multiply(originalSum: number , c: number){
22+
return originalSum * c;
23+
}
24+
25+
function divide(a: number, b: number){
26+
return a / b;
27+
}
28+
1929
pow(base: number, exponent: number): number {
2030
return Math.pow(base, exponent);
2131
}

0 commit comments

Comments
 (0)