I voluntarily used "class" in JavaScript today. Feeling kinda bad about it. AMA
Yes. Guilty for creating a bag of state some future me will have to understand
-
-
But if you are going to hold onto state, isn't an encapsulation of that state a la class what you want?
-
I prefer to keep my javascript as functional as possible. Some state is unavoidable but I use plain JS objects. Linters are generally not great at dealing with "this". Typescript makes this better. In this case, "class" was the best option.
-
The rule I apply is if I'm dealing with some persistent store, I use a class to interface with it (or in some cases I will use classes for light setter/getter functionality on xml documents). Otherwise, i keep it functional. Typescript is definitely key for me.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.