first post ever here
I'm trying to replicate this sort of JSON object so that I can store it inside localStorage with stringify:
I want to be able to create a new noteState inside of history whenever an event is caught but do not know necessarily how to go about doing so..
var history = {
"noteState1": [
{created: new Date(),
modified: new Date(),
left: "100",
top: "200",
text: "hello"},
{created: new Date(),
modified: new Date(),
left: "150",
top: "250",
text: "new"},
{created: new Date(),
modified: new Date(),
left: "200",
top: "300",
text: "world"}
],
"noteState2": [
{created: new Date(),
modified: new Date(),
left: "100",
top: "200",
text: "hello"},
{created: new Date(),
modified: new Date(),
left: "150",
top: "250",
text: "new"},
{created: new Date(),
modified: new Date(),
left: "200",
top: "300",
text: "world"}
]
}
how can i create a new member with a single array inside history?