I am creating a website where when different functions occur in javaScript, I need to change the value of my local storage. For example here is my current code:
localStorage.setItem('colorvar', '#EBDBC2');
I need to create something where when a function occurs, the value which currently it set to #EBDBC2 will change to a value of my choice. I've tried just duplicating the line of code above and putting it in a function and changing the value but for some reason that wasn't working. Does anybody know how I can create a function where when the function runs, it will change the value in my local storage?