I try to remove specific data from localStorage and found this question.
One of the answers seems to use localStorage as an array but I don't have jQuery. To find the specific key (and value) I try to use a for loop:
localStorage.setItem("order", 1);
for(var i=0; i<localStorage.length; i++){
var item=localStorage[i];
if (item == 'order')
{
alert(item);
// I want to inspect the value...
// and then remove it
localStorage.removeItem(item);
}
}
This code never alerts and the value order
is still there.
What am I missing?