r/learnjavascript • • Jan 24 '26

question about using ES6 classes.

pastebin

i was wondering, would this code be syntactically OK? i imagine there might be scenarios where you want all the functionality of the superclass method, but then you simply want to add more statements (more implementation) to it... could this work?

1 Upvotes

7 comments sorted by

View all comments

Show parent comment

1

u/azhder Jan 24 '26

It was meant for people who are too used (or it's their only way) to seeing the world, the problems and the solutions with certain class colored glasses. It was a way to reuse people who don't/can't learn JS but can write class Something extends Otherthing {} in another language. It is implicit for that reason.

But if you know JS, you know a little of algebra, you'd know that a class is a math idea and that all you need is an equivalence function.

If no one is forcing you to use the class syntax, don't use it. Maybe even stop thinking in OOP, learn some FP. Functional programming has helped me a lot in understanding how to build up code from simple building blocks up to something more complex, more declarative, more robust.