-
-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathmultipleModule.js
More file actions
34 lines (26 loc) · 584 Bytes
/
multipleModule.js
File metadata and controls
34 lines (26 loc) · 584 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
28
29
30
31
32
33
34
console.log('This is multi export module by Kaiwalya');
//This function finds the average of the passed array
function average(arr){
let sum = 0;
arr.forEach(element => {
sum += element;
});
return sum/arr.length;
}
//This function finds the total sum of the array
function totalSum(arr){
let sum = 0;
arr.forEach(element => {
sum += element;
});
return sum;
}
//This function returns the length of the array
function length(arr){
return arr.length;
}
module.exports = {
avg: average,
ts: totalSum,
len: length
}