News for hackers. Stuff that matters.
Re:New ES2019 JavaScript features by boomlinde on Friday September 27, 2019 @05:03AM (#21089862)
JS is and always was prototype based. The class keyword is as far as I know just syntax sugar that creates a prototype chain and a new-able function that assigns the prototype to self.
Re:New ES2019 JavaScript features by jwalton on Friday September 27, 2019 @07:26AM (#21090668)
The '#privateVar' syntax means that classes are no longer simply syntax sugar, unfortunately.
Re:New ES2019 JavaScript features by eropple on Friday September 27, 2019 @09:49AM (#21091928)
Private variables could always be simulated with IIFEs. I'm pretty sure that's actually how TypeScript does it if you compile down low enough.