Ad
  • Custom User Avatar

    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

    A Cylon can be created as either a raider, a basestar, or a centurion. 
    Each type of Cylon has a different attack strategy...
    

    so that depending on what argument you pass the Cylon, the return value of of Cyclon#attack would change. Maybe it could be something like Destroy all humans using [attack strategy].

    You could do something similar HumanSkin.

  • Custom User Avatar

    Use arr.map if you want to change the values of the array. For regular iterations through array values, you can use arr.forEach

  • Custom User Avatar

    FYI: Array.prototype.forEach accepts a context object as a second argument. So instead of

    var self = this;
    arr.forEach(function() { 
      self.whaveter(); 
    }
    

    you can simply do:

    arr.forEach(function() {
      this.whatever();
    }, this);
    
  • Custom User Avatar

    It sure is concise, but it fails the "I know immediately what this code does" test.