If you’re going to use a constructor function, it’s idiomatic to use the class syntax since ES2015. I would only use a class if there’s was a compelling reason. I prefer the factory version for several reasons I have detailed in other blog posts.
- Class might invite users to use `extends` (which leads to problems like tight coupling and the gorilla/banana problem).
- Class defaults to hooking up the prototype chain, enabling `instanceof`, but `instanceof` lies because JS is dynamic, and because `instanceof` always fails across memory realms.
- Classes force callers to use `new` (they throw if you omit it), which is problematic if you ever want to refactor to use factories (a common refactor).