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.
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.
Please use spoiler flag next time, and yes it's ES6 syntax.
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.
You are misusing the Conditional (ternary) operator (see examples following the link).
Please use a spoiler flag next time you give elements of a solution.
You must return a value, your function currently returns nothing. There's no point in calling the function inside your code as you do at the end.
See if this can help you: Troubleshooting Your Solution.
No one is here to teach you programming, this is a very basic kata you can find the whole JavaScript documentation online.
Hi. Please use spoiler flag when divulgating elements of solution. A problem with your code is not a kata issue, please mark it as a question and not an issue next time. You need to use the provided name argument, what you do always returns the same result. Also you don't need to call the function inside your code, the tests do it themselves.
This comment is hidden because it contains spoiler information about the solution