The commenters are correct, this in the context of a static class method is the class itself.
When you create an instance of the class using new, that instance is its own this. You can access properties and methods on the instance through this.
See the examples below:
class Example {
constructor() {
this.name = 'Johan';
}
static hello(){
console.log(this);
console.log(this.name);
}
}
Example.hello(); // logs out the above class definition, followed by the name of the class itself.
let x = new Example();
console.log(x.name); // logs out 'Johan'.
x.hello(); // x does not have `hello()`. Only Example does.
thisinhellois the class itselfthis.namein an instance of a class, which static methods inherently do not have.this.nameusingExample.namerenders undefined.nameis an instance variable. To access it, you must create an instance (in the static method).Example.nameimplies thatnameis a static member of the class, which clearly it isn't.