Web Storage: clear()

The clear() method removes every key and value from one storage area for the current origin.

What you will learn

sessionStorage.clear();

This affects all values in that storage area, not only the values owned by one feature. Prefer removeItem() when you need to delete one key.

Common mistakes