I have a JavaScript class following the ECMA6 standard, and I would like to create a static variable in it .
For this, I read the following documentation:
The first link demonstrates how you can create static methods inside a class in ECMA 6, and the second link demonstrates how you can use prototype and functions to create static variables before ECMA6.
I donβt want any of this. I am looking for something like this:
class AutoMobile { constructor(name, license) {
However, the previous example does not work because the static used only for methods.
How to create a static variable inside a class in JavaScript using ECMA6?
source share