I have found that static members of a class are inherited by its child classes in JavaScript. I have tested it with Chrome 67.0.3396.62, FireFox 60.0.1 and
NodeJS 10.1.0.
But isn't it weird that in OOP, static members and fields should belong to the class and not being inherited?
Is it a bug for JavaScript extends?
class A {
static a () {
console.log('==[static a]==')
}
}
A.propA = { anything: '==[static data from A]==' }
class B extends A { }
console.log(B.a()) // "==[static a]=="
console.log(B.propA.anything) // "==[static data from A]=="