Skip to content

Commit b51939c

Browse files
committed
modified the infinity to -infinity.
1 parent f666df4 commit b51939c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Sprint-1/implement/max.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ function findMax(elements) {
55

66
// If there are no numeric values, return infinity
77
if (numericElements.length === 0) {
8-
return Infinity;
8+
return -Infinity;
99
}
1010

1111
// use Math.max with spread (...) to get the maximum number
1212
return Math.max(...numericElements);
13+
1314
}
1415

16+
1517
module.exports = findMax;

0 commit comments

Comments
 (0)