It should be something like:
class C {
static m() { console.log('hi') }
}
// automatically run C.m
class D extends C { }
A python case is found. Is this possible in JavaScript?
It should be something like:
class C {
static m() { console.log('hi') }
}
// automatically run C.m
class D extends C { }
A python case is found. Is this possible in JavaScript?
Javascript doesn't have a metaclass per se, but you can create a pseudo metaclass by defining a class within a function:
function C() {
class Cls {
static m() { console.log('hi') }
}
Cls.m()
return Cls
}
class D extends C() {} // prints 'hi'