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 11 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?
There was a problem hiding this comment.
Because I thought it would error but it didn't , it showed "[ object Object]" so I used join() to put ingredients on new lines.
There was a problem hiding this comment.
I mean, why use recipe.ingredients.join('\n ') and not recipe.ingredients.join('\n')?
There was a problem hiding this comment.
It just from writing mistake.
| 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)?
There was a problem hiding this comment.
I used parseInt because it gets the number from a string like "50", but Number() would give NaN.
There was a problem hiding this comment.
Both parseInt("50") and Number("50")produce 50 though. Can you elaborate?
There was a problem hiding this comment.
Yeah that works for 50, both parseInt and Number give 50. But my coins are like 50p, so pareseInt works because it read the number at the start and ignores the 'p'. Number(50p) would return NaN because it tries to convert the whole string and fails.
|
All good. Well done. |
Self checklist
Changelist
I have answered the task as required.