File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -39,24 +39,32 @@ function myExcelFuns() {
39
39
if ( numberArr [ i ] != "" ) {
40
40
result = result + parseFloat ( numberArr [ i ] ) ;
41
41
}
42
+
42
43
} else if ( document . getElementById ( "arrAvg" ) . checked ) {
43
44
45
+ var count = 0 ;
44
46
for ( var i = 0 ; i < numberArr . length ; i ++ )
45
47
if ( numberArr [ i ] != "" ) {
46
48
result = result + parseFloat ( numberArr [ i ] ) ;
49
+ count ++ ;
47
50
}
48
- result = result / numberArr . length ;
51
+ result = result / count ;
52
+
49
53
} else if ( document . getElementById ( "arrMax" ) . checked ) {
50
54
51
55
result = Math . max ( ...numberArr ) ;
52
56
53
57
} else {
54
58
59
+
60
+ numberArr . sort ( ) ;
55
61
result = Math . min ( ...numberArr ) ;
62
+ // result = Math.min(...numberArr);
56
63
57
64
}
58
65
59
66
document . getElementById ( "result" ) . innerHTML = result ;
67
+
60
68
} else {
61
69
alert ( "Please enter a numeric value with spaces to proceed." ) ;
62
70
}
You can’t perform that action at this time.
0 commit comments