Do you know what will be the output of this code?
JavaScript
class Counter {
static create() {
return new Counter();
}
}
const c = Counter.create();
console.log(typeof c.create);
Show answer and explanation
The answer is "undefined".
static puts the method on Counter, not on Counter.prototype. Instances can’t reach it. Call it as Counter.create().