Is there any way to reset/clear browser's localStorage in javascript?
The clear() method removes all the Storage Object item for this domain. The clear() method belongs to the Storage Object, which can be either a localStorage object or a sessionStorrage object.
removeItem("data") With localStorage. removeItem('data') we can remove the localStorage item. Its use case is similar to setItem() – when we want to remove an item, we click a button to complete that functionality.
removeItem() The removeItem() method of the Storage interface, when passed a key name, will remove that key from the given Storage object if it exists.
Use this to clear localStorage:
localStorage.clear();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With