I'd say use ES6 classes. Sure the process of creating a class is slightly bigger than calling a function, but if you do it only sometimes, then there will be no difference for the performance, and you get much cleaner code.
Avoid creating new objects from classes inside loops though, calling a function is better in this case:
// Bad examplefor(i=0;i<1000;i++){constc=newSomething()}// Better examplefor(i=0;i<1000;i++){constc=doSomething()}
I am a software engineer. I love learning and sharing knowledge. I also enjoy the challenge of taking on complex projects and finding creative solutions to problems.
I'd say use ES6 classes. Sure the process of creating a class is slightly bigger than calling a function, but if you do it only sometimes, then there will be no difference for the performance, and you get much cleaner code.
Avoid creating new objects from classes inside loops though, calling a function is better in this case:
For all the other cases you are fine.
ππThanks