get array from objects ids js code example
Example 1: js get object by id from array
myArray.find(x => x.id === '45');
Example 2: get all id from array of objects javascript
function getFields(input, field) {
var output = [];
for (var i=0; i < input.length ; ++i)
output.push(input[i][field]);
return output;
}
var result = getFields(objArray, "foo"); // returns [ 1, 3, 5 ]