Re:What's New in JavaScript for 2019
by Lerc on Tuesday January 22, 2019 @04:21PM
(#18972603)
Ok reading that I'm going to amend my suggestion above.
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 #
[ Parent
| on HN ]
Re:What's New in JavaScript for 2019
by singularity2001 on Wednesday January 23, 2019 @07:38AM
(#18977660)
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}`)
}
}