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'm a big fan of the Elvis Operator - but don't quite feel it contributes to understanding in this case... I went with a more readable 'if'...
Your intial test is superfluous and adds an unncessary if-then. The for loop will 'short circuit' and not run if the array is empty...
The first test isn't strictly necessary - but saves time if the string is just spaces...
I'd completely forgotten that strings can be accessed as arrays!! Doh!