Answer the question
In order to leave comments, you need to log in
How to change boolean value in localStorage?
Hello. I have such a task. When I click on the button, I write to local.push {isOpen: true}
And when I click again, these records are simply duplicated, but how can I make only 1 record and manipulate it by changing it to true-false?
Answer the question
In order to leave comments, you need to log in
el.addEventListener('click', () => {
const value = !localStorage.getItem('isOpen')
localStorage.setItem('isOpen', value)
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question