Using the length
property,
you can find out the number of
entries stored in the local storage:
let num = localStorage.length;
console.log(num);
On button click, display the number of entries in the local storage.
By clicking a button, find out
the number of entries in the local
storage and, if there are more
than 10
, clear the storage.