class Game {
constructor() {
// public field
this.name = "unknown";
this.year = 2000;
}
}
// up to ES6
function GameES5() {
// public field
this.name = "unknown";
this.year = 2000;
// private field
var developer = "unknown";
}
//Support: TC39: Stage 3, Node: 12+, Chrome: 74+
class GameFields {
// public field
name = "unknown";
year = 2000;
// private field
#developer = "unknown";
showDeveloper() {
console.log(this.#developer);
}
}