Sunday, March 25, 2012

check to see if something exists in HTML5 localStorage

I'm trying to understand interfacing with HTML5 localStorage. This seems like a pretty good guide. I did not however see a way within the post, at a glance, to gauge whether or not something exists already in localStorage, so I went fishing for and found this post which suggests checking with the triple equals operator like so:

if (localStorage.getItem("foo") === null) {

No comments:

Post a Comment