Last active
August 29, 2024 13:28
-
-
Save devotdev/690ade9874e8b32ba667039256fbb9b4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Monster { | |
| health: number; | |
| constructor(health: number) { | |
| this.health = health; | |
| } | |
| takeDamage(damage: number): number { | |
| console.log(`Monster health: ${this.health} and damage: ${damage}`); | |
| this.health -= damage; | |
| console.log("Remaining health: ", this.health); | |
| return this.health; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment