Ok reading that I'm going to amend my suggestion above.
class fish {
color = "blue"; // color is now a name in scope for this class definition
#agenda = "Total World Domination" // agenda is now a name in scope for this class definition
...
reveal () {
console.log("I am a "
+ color + " Fish " // interpreted as this.color
+"seeking " + agenda // interpreted as this.#agenda;
}
}
You can still have this.agenda for public addon fields. But for the private one you can refer to it within the class definition without either this. or #
Yes please make the syntax simple like this!
Even cleaner:
class fish {
color = "blue";
private agenda = "World Peace"
constructor(){
color="red"
agenda="Secret World Domination"
}
reveal () {
console.log(`I am a ${color} Fish seeking ${agenda}`)
}
}