Check his Link
http://diveintohtml5.info/storage.html
This is like a crash course for working with local storage also check this article from Mozilla Firefox
http://hacks.mozilla.org/2009/06/localstorage/
here is the official documentation for local storage
http://dev.w3.org/html5/webstorage/
Just For your problem, you can do it like this
localStorage only supports strings. Use JSON.stringify()
and JSON.parse().
var mycars = [];
localStorage["mycars"] = JSON.stringify(carnames);
var storedNames = JSON.parse(localStorage["mycars"]);