Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<h1>The Storage length Property</h1>
<p>This example demonstrates how to use the length property to get the number of items stored in the local storage object.</p>
<button onclick="myFunction()">Get the number of stored items</button>
<p id="demo"></p>
<script>
function myFunction() {
  var x = localStorage.length;
  document.getElementById("demo").innerHTML = x;
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_storage_length by HTTrack Website Copier/3.x [XR&CO'2014], Wed, 21 Dec 2022 17:40:27 GMT -->
</html>