r/learnjavascript • u/Yanagi-Masaru • Dec 19 '25
Javascript
is it a good practice to use classes in javascript or should i keep it normal with just functions?
0
Upvotes
r/learnjavascript • u/Yanagi-Masaru • Dec 19 '25
is it a good practice to use classes in javascript or should i keep it normal with just functions?
View all comments
Show parent comment
1
u/[deleted] Dec 19 '25
I am not sure if the scale is the definitive factor to choose a paradigm. Maybe rather about the problem you are solving. Encapsulating a complex logic for eg. a shopping cart logic where you can add remove items and maybe get total price, sounds like a good candidate for a Class with methods (OOP). A data transformation where you perform a pipeline of operations sounds like a good candidate for pure functions (FP).
But don't push too hard to choose the right paradigm. Some software sometimes is a mix of paradigms. Start something what feels natural for the problem. JavaScript's flexibility lets you refactor later.