Modern way to create static or Class variable for Javascript class
问题 I've been hunting around for a clear answer to this, and most of what pops up still relates to the old (or should I say "traditional") way of defining classes using function . According to this SO answer, Class properties are not supported in ES2015. As far as I can tell, the only way to add a static variable to a class is like: https://jsfiddle.net/abalter/fknwx3n4/ class C { constructor(x) { console.log("in constructor " + x); this.x = x; this.add(this.x); } add(x) { console.log("in add " +