javascript - What to do if there is no data in localStorage? -


i'm in dilemma, have search engine keep last results, perfect until there.

the problem not know if not have items saved, ie if first time search.

if(localstorage.getitem("searchresults") === null) {   // not know here ... }  else {   // here code supposed has                  } 

should not anything, should save empty string, or have change logic i'm working on?

what friends, doing? thank you

i have variable called "noresults", , set false, when search results 0, or can make fetch results server. it's context , logic


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -