I am looking to extract an array of values associated with a specific key from a collection of objects within an array using JavaScript.
Here is the parent array:
const data = [
{employeeId: 033, field: "TAX", active: 1},
{employeeId: 035, field: "ACCOUNTING", active: 1},
{employeeId: 035, field: "SALES", active: 1}
];
The desired output (an array of values for the key named 'field'):
["TAX", "ACCOUNTING", "SALES"]