Strategy Pattern in JavaScript

Photo by Moritz Kindler on Unsplash

Most design patterns articles are written in class-based statically typed languages like Java and C++ . As a front-end developer, JS is a prototype-based dynamic language, and functions become first-class citizens, implementing some design patterns is slightly different, and sometimes confusing, even if it’s not as simple as using a design pattern.

Scenario

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store