JS associative object with duplicate names

That is not an array that is an object. You’d be better creating a property of the object that is an array and store the different values in there.

var myarray = {
   "field_1": "lorem ipsum",
   "field_array": []
};

myarray.field_array.push(value);

then just loop through that property of the array.

Leave a Comment