Is there any way to clear a specific localStorage
in html
using javascript
:
localStorage.setItem("one");
localStorage.setItem("two");
//How to clear only "one"
CodePudding user response:
You can remove an item from the localStorage
with the removeItem
function:
localStorage.removeItem(key);
So in your case:
localStorage.removeItem("one");