-
-
Notifications
You must be signed in to change notification settings - Fork 241
Manchester | 25-ITP-May | Fithi Teklom | Sprint 3 | 3-stretch #868
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would the function still work if line 19 is changed to .reduce((a, b) => a + b);?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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