Skip to content

Instantly share code, notes, and snippets.

@channprj
Last active March 8, 2017 06:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save channprj/8f7a8fb786b929c817539b4674865899 to your computer and use it in GitHub Desktop.
Save channprj/8f7a8fb786b929c817539b4674865899 to your computer and use it in GitHub Desktop.
Count all of sessionStorage values.
var cnt = 0;
for(var i=0; i < sessionStorage.length; i++){
if (JSON.parse(sessionStorage.getItem(sessionStorage.key(i))).length > 0) {
cnt = cnt + JSON.parse(sessionStorage.getItem(sessionStorage.key(i))).length;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment