local Strageの配列オブジェクトを格納する方式

398 ワード

localStorage                    ,

                     ,                 

     :

 :
    var obj = {"name":"xiaoming","age":"16"}
    localStorage.setItem("userInfo",JSON.stringify(obj));
 :
    var user = JSON.parse(localStorage.getItem("userInfo"))
  :
    localStorage.remove("userInfo);
  :
    localStorage.clear();