Last active
September 29, 2016 20:28
-
-
Save parties/13ca53e02013b29bb0f5418a92c74902 to your computer and use it in GitHub Desktop.
count characters in local storage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getStorageSize = function() { | |
return Object.keys(window.localStorage).map(function(key) { | |
return window.localStorage.getItem(key).length; | |
}).reduce(function(prev, curr) { | |
return prev + curr; | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment