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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -