Skip to content

Commit e789ef9

Browse files
committed
modified function fo max.js
1 parent f64fe71 commit e789ef9

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎Sprint-1/implement/max.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ function findMax(elements) {
22
if (!Array.isArray(elements)) {
33
throw new Error("findMax requires an array of numbers");
44
}
5-
if (elements.some((element) => typeof element === "string")) {
5+
if (elements.some((element) => typeof element !== "number" ||Number.isNaN(elements))) {
66
throw new Error("findMax requires an array of numbers");
77
}
88
return Math.max(...elements);
9-
}
9+
}
10+
1011
module.exports = findMax;

0 commit comments

Comments
 (0)