Number of entries in a localStorage in JavaScript

Using the length property, you can find out the number of entries stored in the local storage:

javascriptlet num = localStorage.length;
console.log(num);
Задание 1

On button click, display the number of entries in the local storage.

Задание 2

By clicking a button, find out the number of entries in the local storage and, if there are more than 10, clear the storage.