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.
The meaning of "Cylons should have a model" was very unclear to me, especially since you wanted the "model" to be string or an arbitrary number (I expect a model to be a data object).
Here's another way we could setup this kata
so that depending on what argument you pass the Cylon, the return value of of
Cyclon#attack
would change. Maybe it could be something likeDestroy all humans using [attack strategy]
.You could do something similar HumanSkin.
Use
arr.map
if you want to change the values of the array. For regular iterations through array values, you can usearr.forEach
FYI: Array.prototype.forEach accepts a context object as a second argument. So instead of
you can simply do:
It sure is concise, but it fails the "I know immediately what this code does" test.