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.
I know you asked this question a long time ago, but I think it is because trim() removes leading and trailing white spaces. The Kata asks you to remove all spaces, including the ones in between strings of characters.
Please use spoiler flag next time.
This comment is hidden because it contains spoiler information about the solution
Looks like you're from Kazakhstan as well as me) But that's not about the question. I think you've already got the right answer, but a strong wish to help you out makes me to keep on). I think the problem is that you have separated firstname and lastname. I am a newbie as well, but as I understood test checks your code via string that contains both name and surname. By the way, the kata contains small tip: "This kata strictly takes two words with one space in between them.". So you've got to use this tip, because finding space can show the way to the first letter of surname.
This comment is hidden because it contains spoiler information about the solution
Your post contained the whole solution, that's why it was a spoiler. Posts here are visible in the homepage if you don't flag them.
Ok, sorry for spoiler. I was think this issimple question, not spoiler.
Thank you for the answer!
Please use spoiler flag next time, and yes it's ES6 syntax.
This comment is hidden because it contains spoiler information about the solution
you need to return the value, not print
This comment is hidden because it contains spoiler information about the solution
Please say which language you're using (I can't even know if your code is syntactally correct). You do not modify the string by printing it, so it does not work (you always return the original string), and you don't have to call the function inside your code as you do at the end, tests do that by themselves.
No problem, welcome :) But you have to practice and learn by yourself, for many 8kyus katas in JS you'll find easily the answers online (and for this one in particular).
Yeah, as akar-0 says, you are using conditional (ternary) operator wrong.
When using conditional (ternary) operator you need to make it as small as possible and not too complicated. It is a shortcut to a normal
if
starment, not a replacement.Basically you cannot call
return
inside the conditional (ternary) operator, and that is all your issue is. Istead try these:With conditional (ternary) operator you normally replace the value in a call, not the call itself.
Loading more items...