javascript - Pushing data into an array in a Json object -


i need push an object array in in json file. make simple lets json looks this:

var jsonobj = { "elements" : [] } 

i tried push() method didnt work. tried assign jsonobj.elements[0]= ... fails. how can make work?

try way, has work:

jsonobj.elements.push(1); 

fiddle: https://jsfiddle.net/29qa4bfw/1/


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -