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.
It's really kind of a moot point. The Array conversion trick wouldn't be necessary if
String.prototype.repeat
was defined, but it's not available and for a one-liner Kata it's not worth trying to polyfill it.If it was undefined then
available[key] / recipe[key]
would evaluate toNaN
and then default to0
via the||
operator.Hopefully
recipe[key]
wouldn't be undefined since you're mapping overObject.keys(recipe)
.My solution is about 5 times faster and doesn't rely on array conversion.