Skip to content

Instantly share code, notes, and snippets.

@devotdev
Last active August 29, 2024 13:28
Show Gist options
  • Select an option

  • Save devotdev/690ade9874e8b32ba667039256fbb9b4 to your computer and use it in GitHub Desktop.

Select an option

Save devotdev/690ade9874e8b32ba667039256fbb9b4 to your computer and use it in GitHub Desktop.
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