Challenge: Solution Review
This lesson will explain the solution to the problem from the previous coding challenge.
We'll cover the following...
We'll cover the following...
Solution #
Explanation
As explained in the problem statement, we need to implement a functionality that doesn’t allow dresses with the same serialNumber to be made more than once. For this purpose, a flyweight factory can be used. Before we get into that, let’s look into the Dress class first.
class Dress{
constructor(serialNumber,type,color,designer,availability){
this.serialNumber = serialNumber
this.type = type
this.color = color
this.designer = designer
this.availability = availability
this.price = 0
}
...