简体   繁体   English

使用本地存储

[英]Working with localstorage

I am building an online os and have an issue. 我正在建立一个在线操作系统,有一个问题。 Is it possible to add data to the current values ​​of the local storage object without removing the current values​​? 是否可以在不删除当前值的情况下将数据添加到本地存储对象的当前值?

Kind of. 的种类。 All local storage variables (as far as I know. correct me if I'm wrong) are stored as strings. 所有本地存储变量(据我所知。如果我写错了,请更正)都存储为字符串。 So "adding" a bit of data to a local storage variable could be done by appending it to the existing value. 因此,可以通过将数据追加到现有值来“添加”一些数据到本地存储变量。 eg 例如

localStorage["myHandle"] += "blah";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM