How can i add fields inside empty array?

Good morning guys

I have to create a new JSON object array using the user array but when I do this getting the below error.
could someone help me here? or help me to understand the mistake?

var users = [{ "name":"John", "age":30, "car":"fiat" },{ "name":"Raj", "age":28, "car":"hundai" }];

var allUser =[]

for (var i = 0; i < users.length; i++) {
  test(i, users[i])

function test(i, user) {
  <!-- allUser.push({"username"}); -->

  allUser[i].username =;
  //allUser[i].userage = user.age;
  //allUser[i].usercar =;

enter image description here

Expected Result:

all user should be like this

[{ "username":"John", "userage":30 },{ "username":"Raj", "userage":28 }]

75 thoughts on “How can i add fields inside empty array?”

  1. therapie cognitivo comportementale st-jerome pharmacie en ligne italienne , therapies esseniennes therapies breves angers , Mobic pharmacie Canada, Acheter Mobic 15 mg pas cher. Mobic pharmacie Canada Mobic pas cher [url=]Mobic livraison Canada[/url] therapie de couple streaming vf Acheter Propranolol 40 mg pas cher, Propranolol livraison QuГ©bec. Propranolol sans ordonnance QuГ©bec Propranolol pas cher [url=]Propranolol livraison QuГ©bec[/url] , pharmacie odyssee aix en provence therapies epilepsy , pharmacie kremlin bicetre. ouverture pharmacie argenteuil Kamagra livraison Canada, Kamagra livraison Canada. Kamagra pharmacie Canada Kamagra pas cher [url=]Kamagra livraison Canada, Kamagra pas cher[/url] , pharmacie montaigne brest medicaments contenant des sulfites, therapie cognitivo comportementale wikipedia therapie cognitivo comportementale chalon sur saone . medicaments wala, pharmacie auchan leers pharmacie gory bourges pharmacie leclerc lamballe .


Leave a Comment