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.
indexOf on the alphabet array is awesome, love how concise it is! I picked this for best practice because you commented your code, in addition to writing legible code in the first place.
Sorry to nitpick, but doesn't str need one character at the beginning? As written, str.indexOf('a') = 0, but the instructions specify a = 1.
Nah. Best practice is to follow specifications. You can add validation if you feel like the client/user is implying its requirement, but the description definitely does not imply that. In fact, based on the description, it sounds like something would be feeding validated troll comments to this function, so the implication is that arguments are already validated. He added completely unnecessary code. Even though it was a few characters here, that kind of mind set can lead to a lot worse outcomes in real production.
This comment is hidden because it contains spoiler information about the solution
Nice and concise. This solution returns the correct answer if input is valid. However, per instructions invalid input should return 0. This solution throws an error on non-int arguments.
This comment is hidden because it contains spoiler information about the solution