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.
Calling
makeSum
twice per iteration is now a Best Practice ?!?I had to update my solution and only now actually read the test cases. Great! :]
Also, changed vote and approved. Make more!
Thank-you for taking the time to explain this. I've updated the kata according to your suggestion.
Returning inconsistent datatypes is ++Ungood™ and should be avoided.
You could just as easily have the function return
[ true, "original string" ]
,[ true, "" ]
or even just[ true ]
instead oftrue
. That would enable you to always process the Boolean return value asanswer[0]
. As it is, the function always returns a truthy value and you need toArray.isArray()
(or equivalent) the return value to find out whether or not to further process it. Which is senseless.Edited! Thanks for the advice.
Instead of Answer is OK or Answer is not OK, the return value could be a boolean, so spelling would not matter. Otherwise it was a good excercise