Is possible to have public field in an ES6 class like this:
class Device {
public id=null;
public name=null;
constructor(id,name,token) {
this.id = id; // I want this field to be public
this.name = id; // I want this field to be public
this.token = token; // this will be private
}
}
I know that is easy to have private field—just by put them in constructor (like 'token' field in example code above)—but what about public fields?