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();

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

Recommended Answers

Use a 2D array ..

Jump to Post

All 2 Replies

Use a 2D array ..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.