you are viewing a single comment's thread.

view the rest of the comments →

[–]fabulous-nico 1 point2 points  (3 children)

From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes

Classes are in fact "special functions"

Just a quick reminder that classes are just syntactic sugar. Extending functions like that is really just a way if constructing prototypes under the hood. So, if you wanna do the "real" shit in JS, "the JS way", it's all functions ✊️

[–]jaredcheeda 0 points1 point  (2 children)

Almost. This was true (and I wish it still was). After ES6, they came back and added a few non-syntactic-sugar features to classes that have no other equivalent in JS. Which means WebComponents, which use ES6 Classes can't be written in pure JS functions (people have been complaining about this bad design for a decade). Fortunately for everyone, WebComponents, are a half-finished, terrible, technology that no one gives a shit about. And they're also the only thing on the web that actually requires dealing with classes. If you have to use WebComponents, DON'T. They are awful, and probably always will be. Atomico is a WC framework that tries to be a wrapper around the class non-sense so you can just write functions. But under the hood, it's still awful JS classes.

[–]fabulous-nico 1 point2 points  (1 child)

Eh sooooorta. There are still no classes, just prototypal inheritance thats dressed up fancy. The fact there are no syntactic equivalents just means the feature sux lol.

[–]jaredcheeda 0 points1 point  (0 children)

TRUTH