learning state design patterns in js

working on the visual, but i was wanting to understand how to approach states in javascript first.