localStorage length

suggest change

localStorage is browser-only. localStorage.length is the number of keys stored for this origin. The example below is 3 only when those three keys are the only ones present.

Example:

Set Items

localStorage.setItem('StackOverflow', 'Documentation');
localStorage.setItem('font', 'Helvetica');
localStorage.setItem('image', 'sprite.svg');

Get length

localStorage.length; // 3

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents