Factories are simply functions that create objects. You can use factories instead of classes, and factories are simpler than classes and easier to reason about.

References

  • https://medium.com/humans-create-software/factory-functions-in-javascript-video-d38e49802555
  • https://medium.com/javascript-scene/javascript-factory-functions-vs-constructor-functions-vs-classes-2f22ceddf33e
  • https://www.sitepoint.com/factory-functions-javascript/