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.
ok, thanks
Where did you get that last 20?
...
Read the info on that link please, you need to write
print(whatever_value_you_want_to_inspect)
. In this case,print(arr)
. And that works in both, you need to write it inside your functionfind_hack
, not in another function that doesn't get called in the tests.log outputs only on the 'test' button, not on the 'attempt'
Print the input yourself to debug your code: https://docs.codewars.com/training/troubleshooting#print-input
what are the inputs 'Fixed tests 3'???
Fixed tests 3:
['name3', 'name4'] should equal ['name2', 'name3', 'name4']???
Why???,,,
the code should go perfectly
all other 204 tests have been passed
When you mutate the input, unexpected results could happen. I've changed the tests so it doesn't matter anymore, but keep that in mind.
So please forgive me if I'm missing something basic and this is a moronic question,
but it's a key part of this not to mutate the input?
That happened because you mutated the input in your code. Now it doesn't matter.
Tests pass, but I get "Cannot read property 'reduce' of undefined
at arr.filter" on attempt. Can anyone explain what this means? I'm not using reduce or filter in my code. Is this a bug or a user error?
because count is an object. the ternary operation is checkin if the property (key: value) is in the count object already. if yes, it adds 1 to the stored value, if not it sets/adds the property.
so if string = 'example', the first run is going to see that count is empty, so count['e'] doesn't exist, and it will set count[e] = 1. then you have count = {e: 1}.
Can someone explain to me how the characters are ending up in the 'count' variable in this solution? I understand that it works, I'm not quite getting how.