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.
@juanignaciomalerb4 Incorrect. If the array is empty, then 0 / 0 is done, which results in
NaN
(which is the expected result).ooooh it makes sense now
I think because in the sum prototype he gives an initial value of 0 in the reduce function. So if an empty array is passed that will be the default value
Did you just go ballistic over a year old comment on not yours solution? :thinking:
Why you on every post just hating like your own solution is way more complicated than the toString which is simpler and that makes your solution an overengineered piece of shit. How does it feel to take some of your own medicine asshole, huh?
Not even any constructive criticism you think you're such a smartass yet can't even speak without hating. Stupid loser
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
Loading more items...