I am trying to locally store an object inside an array inside an object.
If I try the following on my console, it works fine:
theObject = {} theObject.theArray = [] arrayObj = {"One":"111"} theObject.theArray.push(arrayObj)
However, if I do what, in my opinion, is equivalent, save for saving the result in localStorage, it fails:
localStorage.localObj = {} localStorage.localObj.localArray = [] stringArrayObj = JSON.stringify(arrayObj) localStorage.localObj.localArray.push(stringArrayObj)
I get the following error ...
localStorage.localObj.localArray.push(stringArrayObj) TypeError arguments: Array[2] message: "—" stack: "—" type: "non_object_property_call" __proto__: Error
Any idea how I can make this work?
Greetings
source share