JavaScript Factory Design Pattern: A Comprehensive Guide