1 parent 32f870e commit 75b3156Copy full SHA for 75b3156
1 file changed
problem46/problem46.js
@@ -5,3 +5,24 @@
5
3. Return the average of the sum of the squared elements
6
7
**Print the result. */
8
+
9
10
11
+const complexMathOperation = nums => {
12
13
+ let sumOfAllNumsSqure = 0;
14
15
+ for(const num of nums){
16
17
+ const squareOfNum = num * num;
18
+ sumOfAllNumsSqure = sumOfAllNumsSqure + squareOfNum ;
19
+ }
20
21
+const averageOfAllNumsTotal = sumOfAllNumsSqure / nums.length;
22
+return averageOfAllNumsTotal;
23
+}
24
25
26
+const numbers = [10, 13, 45, 46];
27
+const result = complexMathOperation(numbers);
28
+console.log(result.toFixed(2));
0 commit comments