Skip to content

Commit 97e2315

Browse files
committed
modified the function of median.
1 parent fe7131b commit 97e2315

1 file changed

Lines changed: 0 additions & 12 deletions

File tree

‎Sprint-1/fix/median.js‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,10 @@ function calculateMedian(list) {
1010
throw new Error("calculateMedian requires an array of numbers");
1111
}
1212

13-
if (list === null || list === undefined) {
14-
throw new Error("calculateMedian requires an array of numbers");
15-
}
16-
17-
if (typeof list === "string" || typeof list === "number") {
18-
throw new Error("calculateMedian requires an array of numbers");
19-
}
20-
2113
if (list.length === 0) {
2214
throw new Error("calculateMedian requires a non-empty array");
2315
}
2416

25-
if (list.every((item) => typeof item === "string")) {
26-
throw new Error("calculateMedian requires an array of numbers");
27-
}
28-
2917
if (list.some((item) => typeof item === "string" || item === null || item === undefined)) {
3018
throw new Error("calculateMedian requires an array of numbers");
3119
}

0 commit comments

Comments
 (0)