var storage = localStorage;
storage.setItem('fruit1','사과');
storage.fruit2 = '귤';
storage['fruit3'] = '포도';
console.log(storage.getItem('fruit1'));
console.log(storage.fruit2);
console.log(storage['fruit3']);
storage.removeItem('fruit1');
delete storage.fruit1;
delete storage['fruit1'];
storage.clear();
var storage = localStorage;
for(var i=0, len=storage.length; i<len; i++){
var k=storage.key(i);
var v=storage[k];
console.log(k+':'+v);
}
var storage = localStorage;
var apple = {name:'사과', price:150, made:'아오모리'};
storage.setItem('apple', JSON.stringify(apple));
var data = JSON.parse(storage.getItem('apple'));
console.log(data.name);