#This book says that to store information in several columns, you need to use json.
But why do I feel like I can just use objects directly instead of json?
I don’t understand why json is used. I hope dalao can answer:
Can I use objects? If not why?
Why use json? These three questions. Thanks
Localstorage stores strings and cannot directly put objects into it
It’s not entirely correct to say it’s json, it should be json in escaped string format.
Remember, local storage can only store strings.
One thing you need to always pay attention to in the original MDN article is that all data will be converted into a string through its .toString method before being saved to any of the memories to be introduced below. So a normal object will be stored as "[object Object]", not the object itself or its JSON form. It is better and more common to use the JSON parsing and serialization methods provided by the browser itself to access objects.
Is it difficult to open the browser and try it out