I have created a class as per the official examples from MDN(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes)
Here is my code
class A {
}
const Mixer = BaseClass => class extends BaseClass {
static val = 10;
}
class B extends Mixer(A) {
myMethod() {
// Need some way to access the static member "val"
}
}
How do I access "val"?
Without mixin(ie class B extends A, and val being a static in class A) I could have done "A.val".
In this scenario, Mixer.val does not work and as per my understanding B extends from an anonymous class, so there is no way to access the super class by name.
Edit: I put the question wrongly. My real problem was to access val in the Mixer itself. Accessing val in B is straight forward, as pointed out my the answers.
For example
const Mixer = BaseClass => class extends BaseClass {
static val = 10;
myMethod2() {
// log the val member
}
}