[英]How to save array of objects in localstorage
To do this you can loop through the array, calling localStorage.setItem()
setting the key
and val
properties for every property in your array of objects.为此,您可以遍历数组,调用
localStorage.setItem()
为对象数组中的每个属性设置key
和val
属性。 Something like this:像这样的东西:
yourArray.forEach(o => localStorage.setItem(o.key, o.val));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.