Factory functions can be powerful ways of abstracting away difficult inheritance situations. They are simply functions that return objects in a desired state. Let’s refactor some objects that share duplicated code to a reusable factory function.
"Factory functions are any function that's not called with a new keyword and returns a new object." Classic.