📅  最后修改于: 2022-03-11 15:03:47.359000             🧑  作者: Mango
// Initializing a class definition
class Hero {
constructor(name, level) {
this.name = name;
this.level = level;
}
// Adding a method to the constructor
greet() {
return `${this.name} says hello.`;
}
}