Let's take a look at the starter code, piece by piece, as it introduces a new formulation of our JavaScript: classes! If you're familiar with classes in Python or other languages, this ES6 introduction will come as a welcome reminder of the use of JavaScript. Let's begin:
class Poke {
...
}
First of all, when declaring a class in JavaScript ES6, we simply create an object! Now, the details of the object are a little different than what we're used to, but many of the principles are the same. To create an instance of the class, we can say const p = new Poke() after finishing the class code.
After that, there is some syntactic sugar with classes, such as constructors, getters, and setters. Feel free to research classes in JavaScript, as it'll help you with the overall goal.
I've given you the starter to a constructor, which is executed when you create an instance of a class:
constructor() {
/**
* Use the constructor as you would in...