Factory functions create objects without the class keyword. They return new objects with closures for privacy.
function createCounter() {
let count = 0; // Private via closure
return {
increment() { count++; },
getCount() { return count; }
};
}
const counter = createCounter();
Some prefer factories over classes for their flexibility.