Manchester | 25-ITP-May | Fithi Teklom | Sprint 3 | 3-stretch#868
Manchester | 25-ITP-May | Fithi Teklom | Sprint 3 | 3-stretch#868Fithi-Teklom wants to merge 15 commits intoCodeYourFuture:mainfrom
Conversation
|
Your PR's title isn't in the expected format. Please check the expected title format, and update yours to match. Reason: Wrong number of parts separated by |s If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
1 similar comment
|
Your PR's title isn't in the expected format. Please check the expected title format, and update yours to match. Reason: Wrong number of parts separated by |s If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). |
cjyuan
left a comment
There was a problem hiding this comment.
Branch is not clean (no wonder the code looks familiar)
| const sum = numStr | ||
| .split("") | ||
| .map(Number) | ||
| .reduce((a, b) => a + b, 0); |
There was a problem hiding this comment.
Would the function still work if line 19 is changed to .reduce((a, b) => a + b);?
There was a problem hiding this comment.
The function will not work correctly in all cases if you remove the initial value.
You should keep .reduce((a, b) => a + b, 0) to ensure consistent, safe behavior.
There was a problem hiding this comment.
I was asking, will your function work differently if line 19 is changed from .reduce((a, b) => a + b, 0); to .reduce((a, b) => a + b);?
Can you find an example where your function would work differently?
Suggestion, look up how .reduce() work.
Change is optional as this is a stretch exercise, but it’s never too early to develop the kind of attention to detail that defines great software developers. |
Self checklist