Removing the localStorage data in JavaScript

Using the removeItem method, you can remove data and its associated key. Let's remove the contents of some key for example:

localStorage.removeItem('key');

Now let's check the data:

let value = localStorage.getItem('key'); console.log(value); // shows null

Make a page refresh counter. Let the counter be reset after it reaches 10.

enru