No, there is no such built-in functionality. See the spec for the Storage
interface:
interface Storage {
readonly attribute unsigned long length;
DOMString? key(unsigned long index);
getter DOMString getItem(DOMString key);
setter creator void setItem(DOMString key, DOMString value);
deleter void removeItem(DOMString key);
void clear();
};
And the following line just to confirm that further:
The
getItem(key)
method must return the current value associated with the given key. If the given key does not exist in the list associated with the object then this method must return null.
You can just use the usual techniques. Something like this should be fine:
var preference = localStorage.getItem('some-key') || 'Default Value';