Clearing localStorage in javascript?

Is there any way to reset/clear browser's localStorage in javascript?


Use this to clear localStorage:

localStorage.clear();

If you want to remove a specific Item or variable from the user's local storage, you can use

localStorage.removeItem("name of localStorage variable you want to remove");