|
|
|
|
|
by eyelidlessness
1618 days ago
|
|
I use classes quite a lot. And I’m kind of a FP zealot. I generally treat class as a struct value type, and I also generally go to the trouble of marking every property readonly. They’re useful for several reasons: - Abstract classes are useful for defining nominal interface types - Classes are a clear signal that a set of methods are designed to interact with related data types - The prototype chain can be helpful for debugging where POJOs may lose information in the call stack - JS runtimes can sometimes optimize classes in ways they can’t with POJOs |
|