I have an array of objects like below, let's say arrayValues
:
{ field1 : "933", field2 : "something", fieldN: "344" }
{ field1 : "21", field2 : "something", fieldN: "344" }
{ field1 : "34", field2 : "something", fieldN: "344" }
Using jQuery foreach I am trying to get value of field1
for each object in the array and then add them to another array, let's say newArray
:
var newArray = [];
$.each(arrayValues, function () {
newArray.push('what to put here?');
});
At the end, newArray
should contain: 933, 21, 34
How to do this?