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.
One loop deep, maybe. How can you
sort()
a thing without looping over it? And I'm out of my league so I'll just ask: doesstr1.split('')
provide a new view into existing data, or does it have to loop over and copy data piece by piece into a new structure?Just take a look at how many times the function is being called, and if you're not returning anything, it can't call
undefined("some string")
, which is why you're seeing the error.it works correctly in JS. The task is a bit unusual, that's all.
It may sound surprising, but this message shows up exactly because you're returning a string/
undefined
, instead of a function.As far as I can tell, the only thing that's broken here is your solution. The description has an example of how it's supposed to work, so you can have a general idea about what to expect - if you don't know how to achieve this, how come it's the kata's fault?
I slightly modified the description.
Yes. But only when there are many people with the same number or when it's not in the phone book. No idea why an alias was used there.
I guess
unshift
has to move all the elements one position and then you have a nested loop there. Not sure, but very likely.Well that's the challenge, isn't it?
Not sure what you mean exactly, but here's the rule you might've missed:
No whitespaces / underscore
so cases 2 and 4 fail because they contains spaces or
_
"At least one character ("" is not valid)" => string is at least 1 character long (not empty string)
At least one character ("" is not valid)
means empty string is not valid.indexOf
is a loop-alike method, so you're using nested loops there.