Skip to content

Instantly share code, notes, and snippets.

@bradleykronson
Created October 25, 2021 10:46
Show Gist options
  • Save bradleykronson/7eefce91219cb4a982d826ce8fab8f10 to your computer and use it in GitHub Desktop.
Save bradleykronson/7eefce91219cb4a982d826ce8fab8f10 to your computer and use it in GitHub Desktop.
Calculate size of object in session storage
var count = 0;
for (const property in app) {
try {
var l = JSON.stringify(app[property]).length;
count += l;
console.log(`${property}: ${l}`);
} catch(e) {
// meh
}
};
console.log(`Total: ${count}`);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment