Possible Duplicate:
Is localStorage.getItem(‘item’) better than localStorage.item or localStorage[‘item’]?
While learning about localStorage, I noted that it was possible to set and retrieve values from localStorage using array-accessor notation. I haven't been able to find anything super conclusive on whether it is bad or acceptable practice to use localStorage in this manner.
var foo = localStorage.getItem('Foo');
OR
var foo = localStorage['Foo'];
Similarly,
localStorage.setItem('Foo', foo);
OR
localStorage['Foo'] = foo;
Any gotchas? Or am I free to use the shorter syntax?