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.
This is how I did it but I used a ternary operator
Oh I never saw that one, thanks you for reply !
Hi! This is a shorter way of accessing the
.charAt()
method on a string. Take a look at the docs here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String#character_accessHi! Beginner here, I thought [] was for the array only. Why, can we use [] for the string "name" here? Sorry for my bad english.
This is more or less how I did mine. The only difference is that I used string interpolation instead.
This comment is hidden because it contains spoiler information about the solution
In general a good practice is to avoid unnecessary code, but sometimes it's better to write more for readability.
Isn't also a best practice not to have multiple return statements when not necessary?
It's not a good practice to put else statement after return.
@Erhytr how did you figure that out?
This comment is hidden because it contains spoiler information about the solution
I hadn't realized how awesome it is to be able to review other solutions until this challenge. I knew there was a better way than my initial solution, but it's so great to be able to review all of them and see some of the ideal ways of going about things.