Sheffield | 26-ITP-Jan | Seti Mussa | Sprint 2 | Data Group#1172
Sheffield | 26-ITP-Jan | Seti Mussa | Sprint 2 | Data Group#1172Seti-Jemal wants to merge 7 commits intoCodeYourFuture:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| console.log(`${recipe.title} serves ${recipe.serves} | ||
| ingredients: | ||
| ${recipe}`); | ||
| ${recipe.ingredients.join('\n ')}`); |
There was a problem hiding this comment.
Why place two extra space in the separator?
| return false; | ||
| } | ||
|
|
||
| return Object.prototype.hasOwnProperty.call(obj, prop); |
There was a problem hiding this comment.
Can also explore Object.hasOwn().
| // Given invalid parameters like an array | ||
| // When passed to contains | ||
| // Then it should return false or throw an error | ||
| test("return false for invalid input like an array", () => { | ||
| expect(contains([], "a")).toBe(false); | ||
| }); |
There was a problem hiding this comment.
This test does not yet confirm that the function correctly returns false when the first argument is an array.
This is because contains([], "a") could also return false simply because "a" is not a key of the array.
Arrays are objects, with their indices acting as keys. A proper test should use a non-empty array along with a valid key to ensure the function returns false specifically because the input is an array, not because the key is missing.
| const index = pair.indexOf("="); | ||
| if (index === -1) continue; |
There was a problem hiding this comment.
FYI: "key1&key2" is also a valid query string.
No change required.
|
|
||
| const counts = {}; | ||
|
|
||
| for (const item of items) { | ||
| counts[item] = (counts[item] || 0) + 1; | ||
| } |
There was a problem hiding this comment.
Does the following function call return the value you expect?
tally(["toString", "toString"]);
Suggestion: Look up an approach to create an empty object with no inherited properties.
There was a problem hiding this comment.
Have you tried running this script or the tests in mode.test.js?
| let total = 0; | ||
|
|
||
| for (const [coin, quantity] of Object.entries(till)) { | ||
| const value = parseInt(coin); |
There was a problem hiding this comment.
Can you explain why you choose to use parseInt(coin) instead of Number(coin)?
Self checklist
Changelist
I have answered the task as required.