Challenge: Factory Pattern

In this challenge, you have to implement the factory pattern to solve the given problem.

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:

  • color ...