The localStorage-object has get- and set-methods for reading / writing data.
localStorage['mainColor'] = '#efefef';
Local storage, as well as other forms of web storage, follows the Web storage specification.
You could use
getItem to get a key value with the same name as one of the methods.
Also, and probably more important,
getItem, as well as
removeItem, silently ignore if the item doesn't exist, which makes using them easier in many cases.
One other possible difference, although I haven't tested this. The specification says: "When the setItem(), removeItem(), and clear() methods are invoked, events are fired on the Window objects of other Documents that can access the newly stored or removed data". So maybe this event is invoked when you use
setItem('prop'), but not when you use