Skip to content

Commit ad1cb78

Browse files
authored
Fix median function to handle empty filtered list
1 parent 9fc3bd1 commit ad1cb78

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎Sprint-1/fix/median.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function calculateMedian(list) {
2222
return null;
2323
}
2424
const filteredList = list.filter((value) => typeof value === "number");
25-
if (filteredList.length < 2) {
25+
if (filteredList.length < 1) {
2626
return null;
2727
}
2828
const sortedList = filteredList.sort((a, b) => a - b);

0 commit comments

Comments
 (0)