Question

I have used localStorage["key"] and key being different strings to store my values while developing my app.

Now I don't even know what all keys I have used.

Is there a way to retrieve all key's and its values from my file system?

And is there a way to drop the entire localStorage?

Was it helpful?

Solution

localStorage.clear(); worked just right for dropping!

But the other question of knowing and retrieving all key-value pair still remains.

OTHER TIPS

You can use the iterator to get all the keys...

for (var key in localStorage) {
    console.log(key + ": " + localStorage[key]);
}

Per oneofthelions, localStorage.clear() works to remove all items.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top