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.
Or none at all! This is intentional,
sum([1,2,3], [4,5,6], [7,8,9], () => 1)
=>3
is correct. Evensum([1,2,3], () => Math.random())
is a correct usage ofsum
. The direct analogy is something like[1,2,3].map(() => 1)
=>[1,1,1]
. My guess was that examples #2 and #3 perfectly clarify this behaviour. Do you think I need to explicitly state this in the description?Hi, I agree that it is not clear from the description that the default value must be 0, especially in a case like
sum([], () => 12345)
, I will update the description. Could you elaborate the "one cannot always do the task as explained" a bit further, probably by providing some examples?Hi catchaser, yes, you are right, the result must be 68. I don't understand why you are seeing this (all test cases expect "0"), I just checked and everything works fine for me. Probably something wrong with codewars' test runners? Are you using Node v10.x?
yes, they are >:)
great kata, but I think you should make it more obvious, that in 'leading-edge case' the function shouldn't be called after the specified timeout.
Yes, of course I tried your code. And I've used it countless times in industrial projects. I always use
hasOwnProperty
when iterating over objects' keys this way though (asObject.keys
does this for me).You definitely have a good point, I'll adjust the kata and resolve the issue when I have time.
Thanks a lot for your suggestions & detailed explanations! :)
My bad again, you are absolutely right with this properties stuff.
Thank you for your feedback!
.
This comment is hidden because it contains spoiler information about the solution
Done.
Your suggestion seems overcomplicated, as it is ok to go with
new Strip([...strip.raw()])
. It also does not work, throwingTypeError: Property description must be an object
, asstrip
is, obviously, not a properly-defined descriptor.I guess something like this might be an option (at least it works as expected):
I'm not a certified programmer though, so any objections to this are welcomed.
UPD: of course, it doesn't really work
as expected
, because it is just a shallow copy, so something likeuStrip._points = [0]
will break everything, but you've got the point. Nevertherlessnew Strip([...strip.raw()])
works as intended.I was afraid that asking users to interpolate values for themselves might have been considered as too complicated :) thank you for your feedback!
So I've published a kata, but it didn't appear on the list of beta katas. What might be the problem?
Loading more items...