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.
Gorynych, please remove the solution from the comment, it's already available in the Solutions section. Thanks.
This comment is hidden because it contains spoiler information about the solution
Sorry for late reply. You are not returning anything from
array_diff
, which is why you're getting the error.Unfortunately, I can't edit either.
What are you returning from
array_diff
function?This crash is possible if you return
undefined
. I can't edit the test cases anymore, sorry.Thanks - you're both right, I've corrected the second code example.
Awesome solution, it convinces me to change the category to Reference.
Great kata! And I would keep the low timeouts, forces an efficient solution
Thanks jhoffner!
I agree with Icefox, I also do not understand why a single word is a special case.
For example:
truncate('This is my testing function what is it going to do.',3) # returns "This..."'
truncate('Thisismytestingfunction.',10) # returns 'Thisismytes...'
truncate('Thisismytestingfunction omg.',10) # returns 'Thisismytestingfunction'
Shouldn't the first word, which is longer than the limit also be truncated?
I'm a bit confused, whenever I run the code (even with an empty method), I get "NoMethodError: undefined method `+' for 0:Fixnum".
Could you help?
This page explains well what is going in in Array#reduce: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce
I originally had a line like that:
return false if string.length.even?
but I passed. This is of course wrong, but it would be cool to have a test for this. Could you add a test with an even palindrome?