8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f642af7 commit 7545c38Copy full SHA for 7545c38
MyCalculator.js
@@ -0,0 +1,38 @@
1
+const add 8000 = (a, b) => {
2
+ return a + b;
3
+};
4
+const sub = (a, b) => {
5
+ return a - b;
6
7
+const mul = (a, b) => {
8
+ return a * b;
9
10
+const div = (a, b) => {
11
+ return a / b;
12
13
+
14
+const calculator = (c, d, task) => {
15
+ switch (task) {
16
+ case "add":
17
+ return add(c, d);
18
+ case "sub":
19
+ return sub(c, d);
20
+ case "mul":
21
+ return mul(c, d);
22
+ case "div":
23
+ return div(c, d);
24
+ default:
25
+ return `The task ${task} is not defined`
26
+ }
27
28
29
+let c =5
30
+let d=10
31
+let value=calculator(c,d,"add")
32
+console.log(value)
33
+ value = calculator(c,d,"sub")
34
+ console.log(value)
35
+ value = calculator(c,d,"mul")
36
37
+ value=calculator(c,d,"div")
38
0 commit comments