For example lets say I have a JSON object that contains states and cities. like so
var obj = {
states : [
{'state1' :
{cities : ['city', 'another']}
}
]
}
Now lets say our script adds a state by doing obj.states.push(stateVar)
How can we add cities to this newly created state? I have tried things like obj.states[1].push(cityVar)
or obj.states[1].cities.push();
but that gives a this is not a function error.