Remove Storage Item
suggest changeTo remove a specific item from the browser Storage (the opposite of setItem
) use removeItem
localStorage.removeItem("greet");
Example:
localStorage.setItem("greet", "hi");
localStorage.removeItem("greet");
console.log( localStorage.getItem("greet") ); // null
(Same applies for sessionStorage
)
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents