I am learning classes in JS, and I have tried to see how static get works. From reading about it, I thought this would work:
class Builder {
constructor() {
this.number = 1;
}
static get increaseNumber() {
return 1 + this.number;
}
}
const builderInstance = new Builder();
But, I get undefined when I try to run this:
console.log(builderInstance.increaseNumber);
If I remove the static keyword then it works, why do I get undefined if I use static?