localStorage详解
转自:https://www.jianshu.com/p/39ba41ead42e
localStorage方法:
名称 | 作用 |
---|---|
clear | 清空localStorage上存储的数据 |
getItem | 读取数据 |
hasOwnProperty | 检查localStorage上是否保存了变量x,需要传入x |
key | 读取第i个数据的名字或称为键值(从0开始计数) |
length | localStorage存储变量的个数 |
propertyIsEnumerable | 用来检测属性是否属于某个对象的 |
removeItem | 删除某个具体变量 |
setItem | 存储数据 |
toLocaleString | 将(数组)转为本地字符串 |
valueOf | 获取所有存储的数据 |