1// Initializing a class definition
2class Hero {
3 constructor(name, level) {
4 this.name = name;
5 this.level = level;
6 }
7
8 // Adding a method to the constructor
9 greet() {
10 return `${this.name} says hello.`;
11 }
12}