Retired
Use reduce() to calculate the sum of the values in an array (retired)
6,062 of 6,124FesterBesterTester
Loading description...
Arrays
Functional Programming
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
The reduce method always returns the first argument as the total, always write 'return statement' before the first argument of the callback function,
This kata is a subject to deduplication process here: https://github.com/codewars/content-issues/issues/73 Please join the discussion to share your opinions, and help us identify duplicate kata and retire them.
Retired.
This comment has been hidden.
You will have to return your solution for the function to work properly.
This kata is basically just "read the doc on this method and copy and paste the code" Maybe try to apply the .reduce() method in a creative way that makes the coder think outside the box and use .reduce() in a slightly different way that the documentation example.
This comment has been hidden.
Very easy, solution in documentation you've provided
Reading the docs often leads to a solution.
But in this case was a thing of copy pasting the exact same code in the given documentation. Didn't like, didn't learn anything :(
Perhaps there should be an empty array test case?
Good idea. I wish I'd thought of that when writing the kata. Alas, I think adding it now would be unfair to the people who've already submitted solutions, since I didn't specify in the description what the behavior should be when given an empty array.
thanks