I need to declare some properties for my class but this does not work:
class MyClass {
var property1; //<--error raised!
var property2;
constructor(prop1,prop2) {
this.property1 = prop1;
this.property2 = prop2;
}
}
It seems ECMAScript 6 has no class property declaration yet? I'm using NodeJS 4.x which supports ECMAScript 6.
Updated: ES6 stage 3 now has public & private properties: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes#Field_declarations