After utilizing the API, I receive an array of objects structured as follows:
[
{ id: 5, name: "foo" },
{ id: 7, name: "bar" }
]
My goal is to extract only the ID values and transform the array into this format:
[5,7]
What approach would be regarded as the optimal practice in this scenario?