-
-
Notifications
You must be signed in to change notification settings - Fork 41
NW6 | Rabia Avci | JS2 Module | [TECH ED]Complete week 2 exercises | Week 2 #231
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for cute-gaufre-e4b4e5 ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
const firstIndex = Math.floor(middleIndex); | ||
const secondIndex = Math.round(middleIndex); | ||
|
||
return (list[firstIndex-1]+list[secondIndex-1])/2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brillant work as always
|
||
test("given an array with strings or numbers, it removes the duplicate values", () => { | ||
expect(dedupe([5, 1, 'a', 'a', 2, 'b', 3, 3, 8, 8])).toStrictEqual([5, 1, 'a', 2,'b', 3, 8]); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
output.push(input[i]); | ||
} | ||
} | ||
return Math.max(...output); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing, don't forget to tidy commented out code :)
|
||
test("given an array with non-number values, returns max, ignore non-numeric values", () => { | ||
expect(max(["17", 12, "c", 5.4])).toBe(12); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
||
|
||
|
||
module.exports = sum; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
||
test("given an array with non-number values, returns the sum of the numerical elements, ignore non-numeric values", () => { | ||
expect(sum(["17", 12, "c", 5.4])).toBe(17.4); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
||
test.todo("creates a country currency code lookup for multiple codes"); | ||
module.exports = createLookup; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
CA: "CAD", | ||
GB: "GBP", | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
return counts; | ||
} | ||
|
||
module.exports= tally; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
||
test("When passed an invalid input like a string to tally, it should throw an error", () => { | ||
expect(() => { tally("invalid input");}).toThrow("Input must be an array"); | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solid tests as always :)
// d) Explain why the current return value is different from the target output | ||
|
||
// he current return value is different from the target output due to a mistake in the way the invert function is assigning values to the invertedObj. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alll correct
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.