If I had an array as such:
var myarray = []; myarray.push({ "Name": 'Adam', "Age": 33 }); myarray.push({ "Name": 'Emily', "Age": 32 });
This gives me an array in which I can pull out values, such as myarray[0].Name , which will give me "Adam".
However, after creating this array, how can I add the “address” field with the value “somewhere” to the array at position [0], so now my fields in this object are at position zero Name , Age and Address with the corresponding values <
I somehow thought splice() , but could not find an example using objects, just examples with simple arrays.
source share