HTML5 Storage is based on named key / value pairs. You store data based on a named key, then you can retrieve this data using the same key. A named key is a string. Data can be any type of JavaScript-supported type, including strings, booleans, integers, or floats. However, the data is actually stored as a string. If you save and retrieve anything other than strings, you will need to use functions such as parseInt () or parseFloat () to force your extracted data to the expected JavaScript data type.
interface Storage { getter any getItem(in DOMString key); setter creator void setItem(in DOMString key, in any data); };
Calling setItem () with an existing named key will silently overwrite the previous value. Calling getItem () with a key that does not exist will return null, and not throw an exception.
Like other JavaScript objects, you can think of the localStorage object as an associative array. Instead of using the getItem () and setItem () methods, you can simply use square brackets. For example, this piece of code:
var foo = localStorage.getItem("bar");
... could be rewritten instead of using square bracket syntax:
var foo = localStorage["bar"];
Perhaps this hope .: D
Link: http://diveintohtml5.info/storage.html
source share