当前位置:网站首页>localStorage、sessionStorage存储字符串或数字注意点
localStorage、sessionStorage存储字符串或数字注意点
2022-07-16 18:53:00 【_处女座程序员的日常】
对于值类型存取时候是不用序列化的(当然也可以)。
踩坑点:存储时做了JSON.stringify的操作,获取时没有做 JSON.parse操作。
对于对象类型在存储时候需要转成JSON格式的字符串,获取时需要转成JSON对象格式。
存储字符串操作:
localStorage.setItem('ability',f);
console.log(localStorage.getItem('ability'))
打印结果:
存储如下:
边栏推荐
- [C language brush leetcode] 539 Minimum time difference (m)
- Initial redis (know redis and common commands)
- Sword finger offer 57 And are two numbers of S
- 第十三篇,STM32 I2C串行总线通信实现
- 为什么网络安全在工厂中很重要?
- Mathematical modeling - Classification Model (based on logistic regression)
- Discussion on ble Bluetooth battery service
- Unity about some possible reasons and solutions for using addforce of rigidbody but it doesn't work
- UE4 shadow: perobjectshadow verification
- [leetcode problem solving report] 423 Rebuild numbers from English
猜你喜欢

科技云报道:构建可观测性的核心能力是什么?

Mathematical modeling - Classification Model (based on logistic regression)

I2C communication protocol realizes data display on OLED display screen

MySQL --- 多表查询 - 表与表之间的关系

Sword finger offer 57 And are two numbers of S

About SQL: orcale SQL, why is the foreign key inventory ID statement of the merchant table invalid

不同的图像patch由不同的专家模型来处理!南洋理工&Mila稀疏融合混合专家模型SF-MoE,具有超强泛化能力!代码已开源!...

Different image patches are processed by different expert models! Nanyang Institute of Technology & Mila sparse fusion hybrid expert model SF MOE has super generalization ability! The code is open sou

I2C通信协议实现在OLED显示屏数据显示

Mysql——字符串函数
随机推荐
R语言使用pcauchy函数生成柯西分布累积分布函数数据、使用plot函数可视化柯西分布累积分布函数数据(Cauchy distribution)
R语言使用lm函数构建多元回归模型、并根据模型系数写出回归方程、使用summary函数计算出模型的汇总统计信息(R方、F统计量、残差分布、残差标准误差、系数等)
C language as a push box
Go language zero knowledge proof gnark framework
Classic application method of installing HAP on Hongmeng development board
[cloud native] Devops (IV): integrated sonar Qube
【PHP代码审计】Pikachu靶场漏洞入门分析
R语言使用glm函数构建泊松对数线性回归模型处理三维列联表数据构建饱和模型、使用step函数基于AIC指标实现逐步回归筛选最佳模型
专属资源池使用最佳实践-Notebook与训练任务联动
Layoffs are coming
动态添加路由刷新页面会出现白屏
如何应对供应链中第三方的安全风险
(manual) [sqli-labs54-57] limit the number of injections: joint injection, error echo, get injection
[Huang ah code] getting started with MySQL - 2. Using data definition language (DDL) to operate the database
R language ggplot2 visualization: use the ggballoonplot function of ggpubr package to visualize faceted balloon graph (visualization of contingency table composed of two classification variables), fac
World Tour Finals 2019 D - Distinct Boxes 题解
[C language brush leetcode] 1432 The maximum difference that can be obtained by changing an integer (m)
实战项目:数据访问层时所遇问题
Unity-2d pixel lattice ablation
New construction process of Hongmeng application development project and generation method of HAP package