javascript - push an assoc object into array -
says that I have done this:
var user = [{id I use push to insert (': 1', 'gender': 'male'}, {'id': 2, 'gender': 'female'}]
{'Id': 2, 'gender': 'female'}] I tried User [0]. Push ({'Swami': true}); But it does not work tht the way.
You are not pushing an object in an array, you are pushing an object into an object .
You can do it by using the jquery method
var object = $ Expansion ({}, object 1, object 2);
Comments
Post a Comment