请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

关于JSON.parse(localStorage.cartList)

老师,如果我在localStorage里有cartList数据之前运行含JSON.parse(localStorage.cartList)的代码会报错是为什么

正在回答 回答被采纳积分+3

1回答

Dell 2021-12-12 21:51:00

因为这个时候 localStorage.cartList 是 undefined,JSON.parse(undefined) 肯定会报错

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信