Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Because it's syntactic sugar. You couldn't do it the old way of doing classes, and you can't do it now
-
@iam13islucky dafuq. The old way doing classes just cries for using their scope for privates.
But the old ways didn't have nice ways for extends and stuff. -
@iam13islucky I guess you only know about the Shit.prototype.thing way, eh?
You could actually just misuse a function as class, by setting props into its this and returning its this and get the instances via new Func(). -
horrible code, of course, but the Prototype thing wasn't any better. And now you got all sorts of vars dangeling around in yo instance. Not better at all.
-
@daintycode let is block scoped, so it'll act private. Dunno what else to tell you
-
@Chefren all these typescript, flow things actually seem more and more nice from day to day tbh.
Related Rants

What only relying on JavaScript for HTML form input validation looks like
Found something true as 1 == 1
Used ES6 classes 'cus I really like doing things the classy way..
...nice shit you can do there...
...
FOR FUCKS SAKE WHO THOUGHT IT IS A WICKED IDEA TO SPECIFICALLY NOT IMPLEMENT PRIVATES IN THAT SHIT.
undefined
ffs
js
pun intended
classes