DEV Community

Discussion on: Design Patterns - Strategy Pattern in JavaScript

Collapse
 
jessekphillips profile image
Jesse Phillips

I don't see the original switch statement going away here. By the end of it all you had a list of strategies and a need to determine which one to use, in the case of the final example you executed all strategies which easily could have been done without the switch statement.

Collapse
 
askerovtamerlan profile image
askerovtamerlan

code below switch statement maybe alternative high-abstract implementation of switch

Collapse
 
carlillo profile image
Carlos Caballero

Perfect!

Thanks.