JavaScript Design Patterns — Behavioral — Strategy
The strategy pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable.
In this example, We have a set of discounts that can be applied to a shopping cart. We can pass the function that we will apply to the constru...
nhannguyen.hashnode.dev1 min read