yosuke-furukawa/tower-of-babel

Exercise Class: "this.health_"

leogonzalez opened this issue · 1 comments

Hi,

on the description of "Class" exercise you show an example constructor:

    var Character = function(x, y) {
        this.x = x;
        this.y = y;
        this.health_ = 100;
    };  
      this.health_ = this.health_ - 10;
    };

when it should be:

    var Character = function(x, y) {
        this.x = x;
        this.y = y;
        this.health_ = 100;
        this.damage = function(){
            this.health_ -=10;
        };
    };

or

    var Character = function(x, y) {
        this.x = x;
        this.y = y;
        this.health_ = 100;
    };

    Character.prototype.damage = function(){
        this.health_-=10;
    };

If you agree, I'd like to submit a PR for this.

I just saw that it is already fixed on the new files. Thanks