Challenge: Factory Pattern
Explore how to implement the factory pattern by designing a ToyFactory that creates toy duck and toy car objects based on input parameters. Understand how to use function constructors and control object creation effectively in JavaScript.
We'll cover the following...
We'll cover the following...
Problem statement
In this problem, you need to implement a factory ToyFactory that can create a toy duck and a toy car object using either the ToyDuck or ToyCar function constructor.
A ToyDuck object should have the following properties:
-
...