I want to write es6 class:
class SomeClass {
static prop = 123
method() {
}
}
How to get access to static prop from <
Usually the simple way is:
class SomeClass {
static prop = 123
method() {
console.log(SomeClass.prop) //> 123
}
}
Note that if you use this, subclasses of SomeClass will access the SomeClass.prop directly rather than SomeSubClass.prop. Use basarat's method if you want subclasses to access their own static properties of the same name.