Skip to content

Commit 68fad28

Browse files
committed
I have fixed a mistake following the feeback instructions
1 parent 96c5786 commit 68fad28

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

Sprint-1/implement/max.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function findMax(elements) {
1313
}
1414

1515
if (!foundNumber) {
16-
return null;
16+
return -Infinity;
1717
}
1818

1919
return max;

Sprint-1/implement/max.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ const findMax = require("./max.js");
1616
// When passed to the max function
1717
// Then it should return -Infinity
1818
// Delete this test.todo and replace it with a test.
19-
test("given an empty array, returns null", () => {
20-
expect(findMax([])).toBe(null);
19+
test("given an empty array, returns -Infinity", () => {
20+
expect(findMax([])).toBe(-Infinity);
2121
});
2222

2323
// Given an array with one number
@@ -63,5 +63,5 @@ test("ignores numeric strings like '300'", () => {
6363
// When passed to the max function
6464
// Then it should return the least surprising value given how it behaves for all other inputs
6565
test("given only non-number values, returns null", () => {
66-
expect(findMax(["hey", "hi", null, undefined, NaN])).toBe(null);
66+
expect(findMax(["hey", "hi", null, undefined, NaN])).toBe(-Infinity);
6767
});

0 commit comments

Comments
 (0)