Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to know memory used in localstorage javascript

var _lsTotal=0,_xLen,_x;for(_x in localStorage){ if(!localStorage.hasOwnProperty(_x)){continue;} _xLen= ((localStorage[_x].length + _x.length)* 2);_lsTotal+=_xLen; console.log(_x.substr(0,50)+" = "+ (_xLen/1024).toFixed(2)+" KB")};console.log("Total = " + (_lsTotal / 1024).toFixed(2) + " KB");


Comment

PREVIOUS NEXT
Code Example
Javascript :: hello world program in node js 
Javascript :: js preventdefault 
Javascript :: remove last 3 characters from string javascript 
Javascript :: javascript foreach key value 
Javascript :: cors in express 
Javascript :: Add click event to querySelectorAll js 
Javascript :: jquery checkbox set checked 
Javascript :: filter array of objects by another array of objects 
Javascript :: disable autocomplete in react fields 
Javascript :: navigate to url javascript 
Javascript :: how to remove last char from string in javascript 
Javascript :: converting binary to text js 
Javascript :: Exceeded maximum budget Budget 10 kB was not met by 478 bytes with a total of 10.5 kB. 
Javascript :: js get string before character 
Javascript :: Javascript function to get the difference between two numbers 
Javascript :: javascript click 
Javascript :: track window size js 
Javascript :: how to add two number using jqueryu 
Javascript :: react native settimeout 
Javascript :: get variable name javascript 
Javascript :: how to get query param in javascript 
Javascript :: createstore is deprecated 
Javascript :: express check if object is empty 
Javascript :: ffmpeg/avconv not found 
Javascript :: react router get host js 
Javascript :: scroll to a tag javascript 
Javascript :: nodejs copy to clipboard 
Javascript :: To install the latest version of React: 
Javascript :: execute code after page load javascript 
Javascript :: install node js lts ubuntu 18.04 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =