initialize a class definition javascript

Solutions on MaxInterview for initialize a class definition javascript by the best coders in the world

showing results for - "initialize a class definition javascript"
Dayton
09 Jan 2021
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}