0

Hello

Lets say in the localStorage object I have the following:

Apple = red
Potato = brown
Gum = blue

And I want to search thru it for the word Potato and then get its value (brown).

How could I do this?

Im thinking:

for (var i=0;i<localStorage.length();i++)
{
    if (localStorage[i]=="Potato")
    {
    var somevariable=localStorage[i].value();
    break;
    }
}

Forgive sintaxis errors as I just thought it up in 15 seconds.

3
Contributors
2
Replies
11
Views
4 Years
Discussion Span
Last Post by imBaCodes
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.