7 kyu
Sum The Array
1,188 of 1,191vasekhlav
Loading description...
Arrays
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.
Hi!
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.
It's not conclusive whether this kata is a duplicate of "sum an array" taks, so for now it stays and will probably take part in deduplication of "extend Array prototype" set of kata.
the kata is either ranked wrongly, or its Unit Test has a mistake, it's missing function call. so i decided to call my function
addSumMethod
but, for the Unit Test in order to succeed this function must be called before testing.So, this is how Sample Test must look like:
And, tbh, i think the author should have done it themselves. With this small hack in Unit Test now it passes the SampleTest, but Attempt still fails :(
Well it works, because you created your own rules, but the tests are correct. You're not required to implement a simple function, you have to implement a function that is callable on Array itself (just like .map() or .reduce())
oh yes, indeed, thank you @B1ts :) i see, i had to extend the Array class :)
Nice one! I would rate it as 6kyu thnx
Good Kata, keep it up :D I ranked it 6kyu for the OOP and altering prototypes involved.
Math.random
should be called before the test loop, not in the condition (=> on every iteration).