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

Popular posts from this blog

c++ - 'std::string' has no member named 'get' list[i]=user.get; -

python - how we can use ajax() in views.py in django? -

javascript - Is there any way to add a new parameter to a function programmatically? -