localStorage length
suggest changelocalStorage 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
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents