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.
+1 for
+ ((i % 2) * 32)
, love itI would agree that either this should be added to the answer or we should get an example function call. This isn't so much an issue of the code doesn't work as it is an issue of there isn't a spec.
Designed for speed, not small code size. Avoid string compares and use switch/case rather than if/else.
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.