I want to loop through each array of my saved localstorage, but with this code
localStorage.setItem("fav", JSON.stringify(merchant));
var savedMerchant = JSON.parse(localStorage.getItem("fav"));
$.each(savedMerchant,function(){
console.log(this);
});
why got this??
String {0: "L", length: 1, [[PrimitiveValue]]: "L"}
VM420:210 String {0: "a", length: 1, [[PrimitiveValue]]: "a"}
VM420:210 String {0: "z", length: 1, [[PrimitiveValue]]: "z"}
VM420:210 String {0: "a", length: 1, [[PrimitiveValue]]: "a"}
VM420:210 String {0: "d", length: 1, [[PrimitiveValue]]: "d"}
VM420:210 String {0: "a", length: 1, [[PrimitiveValue]]: "a"}
VM420:210 String {0: "Z", length: 1, [[PrimitiveValue]]: "Z"}
VM420:210 String {0: "a", length: 1, [[PrimitiveValue]]: "a"}
VM420:210 String {0: "l", length: 1, [[PrimitiveValue]]: "l"}
VM420:210 String {0: "o", length: 1, [[PrimitiveValue]]: "o"}
VM420:210 String {0: "r", length: 1, [[PrimitiveValue]]: "r"}
VM420:210 String {0: "a", length: 1, [[PrimitiveValue]]: "a"}
console.logdifferent than yourJSON.parse... If your console.log works, seems like you should be doingJSON.parse(localStorage.getItem("fav"))