Javascript help - Detect a variable change

Job ID: 31788234

Budget: $10 – $30 USD

I have an event listener that records the value of a toggle slicer in my application. The toggle can have value set to OFF or ON.

I have a variable called filteredValue which contains the value of the current toggle state

eg let filteredValue = state.filters[0].values;


I need to apply an action when the value of that variable changes.

eg When filteredValue changes from OFF to ON then "DO THIS", when filteredValue changes from ON to OFF then "DO THAT"
Related categories: JavaScript jQuery