-
-
Notifications
You must be signed in to change notification settings - Fork 155
Expand file tree
/
Copy path6-calculate.js
More file actions
27 lines (20 loc) · 833 Bytes
/
6-calculate.js
File metadata and controls
27 lines (20 loc) · 833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
'use strict';
/* Call function from function in loop
- Implement function `average` with signature
`average(a: number, b: number): number`
calculating average (arithmetic mean).
- Implement function `square` with signature
`square(x: number): number` calculating square of x.
- Implement function `cube` with signature
`cube(x: number): number` calculating cube of x.
- Call `square` and `cube` in loop 0 to 9, pass results
to function `average` on each iteration.
Add calculation results to array and return this array
from function `calculate`.
Call functions `square` and `cube` in loop, then pass their
results to function `average`. Print what `average` returns. */
const square = null;
const cube = null;
const average = null;
const calculate = null;
module.exports = { square, cube, average, calculate };