Which would be more efficient?
Repeatedly running localStorage.setItem("foo", val), or checking if (localStorage.getItem("foo") !== val) and then running localStorage.setItem("foo", val)? Is it fine to run these as often as every two seconds?
localStorage.setItem("foo", val)
if (localStorage.getItem("foo") !== val)
2.1m questions
2.1m answers
60 comments
57.0k users