1. 对象的操作
- localStorage.a = "hello";
- localStorage.a = "world";
- console.log(localStorage.a);
- delete localStorage.a;
2.自身的API(方法)
2.1设置
localStorage.setItem("key","val");
2..2获取
console.log(localStorage.getItem("key"))
2.3删除
localStorage.removeItem("key");
localStorage.clear(); // 慎用
2.4 查看总数
localStorage.length