On Thu, Sep 29, 2011 at 17:08, Bob Nystrom <[email protected]> wrote:
> class Monster {
>   constructor(this.name, this.health) {}
>
>   attack(target) {
>     log(Monster.attackMessage);
>   }
>
>   get isAlive() {
>     return this.health > 0;
>   }
>
>   set health(value) {
>     if (value < 0) throw new Error('Health must be non-negative.')
>     this.health = value
>   }
>
>   let numAttacks = 0;
> class:
>   const attackMessage = 'The monster hits you!';
> }

+1

-- 
erik
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to