Q:

finding list of elements in the local storage

I'm storing json strings representing objects in the local storage. I write something like this:
window.localStorage.setItem('ItemID' + TheItemID, TheItemInJson);

Now I need to know which items are in the storage. What's a good way to do this?
Thanks.

A:

You would like to use this code:
for(var i=0, len=localStorage.length; i<len; i++) {
    var key = localStorage.key(i);
    var value = localStorage[key];
    console.log(key + " => " + value);
}

