Here is a shorter way of achieving it:

let result = objArray.map(a => a.foo);

OR

let result = objArray.map(({ foo }) => foo)

You can also check Array.prototype.map().

Answer from Jalasem on Stack Overflow
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ javascript โ€บ how-to-get-values-from-specific-objects-an-array-in-javascript
How to get Values from Specific Objects an Array in JavaScript ? - GeeksforGeeks
August 5, 2025 - You can use map() to create a new array of values from the properties of the objects in the original array. Example: The below example demonstrates How to get values from specific objects inside an array in JavaScript Using the map() method.
Discussions

Find a value in an array of objects in Javascript - Stack Overflow
I know similar questions have been asked before, but this one is a little different. I have an array of unnamed objects, which contain an array of named objects, and I need to get the object where ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
javascript - Get array of property values from array of objects with jquery - Stack Overflow
Obviously I could just loop it and build the array but I need to do this a large number of times on a variety of objects. I could write a function to do it but it would be difficult to make the function general enough for my application. ... You have to use jquery loop. I hope this will help to you dear. stackoverflow.com/questions/2342371/โ€ฆ ... Native javascript ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
javascript - How to get value from array of objects? - Stack Overflow
I have an react app, and using redux and props to get array of objects into my component, and i am getting them. But i can't access particular property inside of one of objects that are in that arr... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Javascript get value from an object inside an array - Stack Overflow
Bring the best of human thought and AI automation together at your work. Explore Stack Internal ... Save this question. Show activity on this post. I have an object with key value pairs inside an array: More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
Medium
medium.com โ€บ @lama.ibrahim96 โ€บ 5-ways-to-find-a-value-in-an-array-of-objects-in-javascript-130fa4856e53
5 ways to find a value in an array of objects in Javascript | by Lama Ibrahim | Medium
April 5, 2023 - return A shallow copy of a portion of the given array, filtered down to just the elements from the given array that pass the test implemented by the provided function. If no elements pass the test, an empty array will be returned. Array.filter() returns an array of all the objects that pass the test implemented by the provided function, if we want to return only the first user we can return index 0 of the returned array.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ javascript โ€บ how-to-access-array-of-objects-in-javascript
How to Access Array of Objects in JavaScript ? - GeeksforGeeks
Using the map() method, you can access and transform elements in an array of objects. It applies a function to each object, returning a new array with modified data or specific properties from the original objects.
Published: July 23, 2025
๐ŸŒ
Programiz
programiz.com โ€บ javascript โ€บ examples โ€บ extract-value-array
JavaScript Program to Extract Given Property Values from Objects as Array
// program to extract value as an array from an array of objects function extractValue(arr, prop) { let extractedValue = []; for (let i=0; i < arr.length ; ++i) { // extract value from property extractedValue.push(arr[i][prop]); } return extractedValue; } const objArray = [{a: 1, b: 2}, {a: ...
Find elsewhere
๐ŸŒ
30 Seconds of Code
30secondsofcode.org โ€บ home โ€บ javascript โ€บ array โ€บ pluck values from object array
Pluck values from an array of objects in JavaScript - 30 seconds of code
March 22, 2024 - Instead of having two separate functions for plucking a single value and multiple values, you can create a single function that accepts a variable number of keys. This way, you can pluck any number of values for each object.
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ how-to-access-properties-from-an-array-of-objects-in-javascript
How to Access Properties from an Array of Objects in JavaScript
February 29, 2024 - ... To access an element from an array, you reference the array name, followed by a pair of square brackets containing the index of the element you want to access. Here is an example of accessing the first element from the fruits array:
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ article โ€บ retrieve-key-and-values-from-object-in-an-array-javascript
Retrieve key and values from object in an array JavaScript
March 15, 2026 - const students = [ {name: 'Alice', grade: 'A', subject: 'Math'}, {name: 'Bob', grade: 'B', subject: 'Science'} ]; students.forEach((student, index) => { console.log(`\nStudent ${index + 1}:`); Object.entries(student).forEach(([key, value]) => { console.log(` ${key}: ${value}`); }); }); Student 1: name: Alice grade: A subject: Math Student 2: name: Bob grade: B subject: Science ยท The time complexity is O(n ร— m), where n is the number of objects in the array and m is the average number of properties per object.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ javascript โ€บ how-to-extract-value-of-a-property-as-array-from-an-array-of-objects
How to extract value of a property as array from an array of objects ? - GeeksforGeeks
July 23, 2025 - A helper function is created which consists of a parameter that is our main array of objects. Create a temporary array inside the function in which results will be stored and printed later. Then using the for-of loop, iterate over the values of that array of objects and thereafter select values for the desired chosen key.
๐ŸŒ
Designcise
designcise.com โ€บ web โ€บ tutorial โ€บ how-to-extract-specific-keys-values-from-an-array-of-objects-in-javascript
JS Extract Specific Key's Values From Array of Objects - Designcise
June 1, 2021 - Using Array.prototype.map() would call the provided callback function for each element of the array and add the returned values to the new resulting array. For example: // ES5+ const names = users.map(function (user) { return user.name; }); ...
๐ŸŒ
Vultr Docs
docs.vultr.com โ€บ javascript โ€บ standard library โ€บ object โ€บ values()
JavaScript Object values() - Get Object Values | Vultr Docs
November 6, 2024 - Recognize that arrays are valid object properties and can be retrieved with Object.values(). Display values from an object containing arrays.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ article โ€บ get-only-specific-values-in-an-array-of-objects-in-javascript
Get only specific values in an array of objects in JavaScript?
March 15, 2026 - Use filter() to get multiple objects matching criteria, map() to extract specific properties, and find() for the first matching object. These methods provide flexible ways to work with arrays of objects in JavaScript.
๐ŸŒ
freeCodeCamp
forum.freecodecamp.org โ€บ curriculum help
How to access a specified object's key value in an array of objects? - Curriculum Help - The freeCodeCamp Forum
May 29, 2022 - I need to access the value of name key of the first object in this 2 object array. Using map() returns the value of both objects. How can I access the first one only? let x = [ {name : 'A', age: 20}, {name : 'B', age: 21} ] console.log(x.map(a ...
๐ŸŒ
Intellipaat
intellipaat.com โ€บ home โ€บ blog โ€บ how to extract given property values from objects as array in javascript?
How to Extract Given Property Values from Objects as Array in JavaScript?
July 19, 2025 - Often, you need to extract property values from an array of objects in JavaScript for display, calculations, or filtering. Whether youโ€™re looking to extract values from an object array or get property from object array, the map() method provides ...