Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
This comment is hidden because it contains spoiler information about the solution
what about empty array? does average() method still work?
you could improve code by removing sum += i line because you can do sum with count * (count + 1) / 2 formula. Also, you can move sum and str declarations after count < 0 and count === 0 if blocks because if count <= 0 true, you aren't using these variables but doing extra step declaring them. Also, you can give str initial value "0" so you can start loop with i = 1; no extra looping required :)
you could use for ... of loop because you are not using i index . it would the code more
lol
good point
bloody beautiful!
you don't have to check every time n !== 0 case. if before everything else,if you check !n case and return, you would reduce execution time and redundancy.Also it's not good practice to mutate input.
mutating array isn't
This comment is hidden because it contains spoiler information about the solution
if you omit curly brackets when using arrow function you don't have to use "return" keyword
then why yourself didn't specify ?
ok i am gonna steal and make a meme from it. I know you could do it with recursion but this is faster.thanks man for making me laugh
This comment is hidden because it contains spoiler information about the solution
too lazy
Loading more items...