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
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Object › values
Object.values() - JavaScript - MDN Web Docs
5 days ago - The Object.values() static method returns an array of a given object's own enumerable string-keyed property values.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-object-values-method
JavaScript Object values() Method - GeeksforGeeks
Object.values() takes the object as an argument of which the enumerable property values are to be returned and returns an array containing all the enumerable property values of the given object.
Published: July 12, 2024
People also ask

What does Object.values() return?
An array of the object's own enumerable property values, in insertion order.
🌐
codeshack.io
codeshack.io › home › references › javascript › object.values()
JavaScript Object.values() Method: Syntax, Parameters & Examples
What is the difference between Object.values() and Object.keys()?
Object.values() returns the values; Object.keys() returns the property names.
🌐
codeshack.io
codeshack.io › home › references › javascript › object.values()
JavaScript Object.values() Method: Syntax, Parameters & Examples
How do I sum the values of an object?
Use Object.values(obj).reduce((total, n) => total + n, 0).
🌐
codeshack.io
codeshack.io › home › references › javascript › object.values()
JavaScript Object.values() Method: Syntax, Parameters & Examples
🌐
W3Schools
w3schools.com › jsref › jsref_object_values.asp
JavaScript Object.values() Method
The Object.values() method returns an array of the property values of an object.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › values
Array.prototype.values() - JavaScript - MDN Web Docs
June 19, 2026 - The values() method of Array instances returns a new array iterator object that iterates the value of each item in the array.
🌐
GeeksforGeeks
geeksforgeeks.org › object-values-javascript
Object.values() In JavaScript - GeeksforGeeks
May 22, 2023 - Object.values() takes the object as an argument of which the enumerable own property values are to be returned and returns an array containing all the enumerable property values of the given object.
🌐
Bobby Hadz
bobbyhadz.com › blog › javascript-get-object-values-as-array
Convert an Object's Values or Keys to an Array in JavaScript | bobbyhadz
To get the values of an object as an array, use the `Object.values()` method, passing it the object as a parameter.
Find elsewhere
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Object › entries
Object.entries() - JavaScript - MDN Web Docs
4 days ago - This is the same as iterating with a for...in loop, except that a for...in loop enumerates properties in the prototype chain as well. The order of the array returned by Object.entries() is the same as that provided by a for...in loop. If you only need the property keys, use Object.keys() instead. If you only need the property values, use Object.values() instead.
🌐
CodeShack
codeshack.io › home › references › javascript › object.values()
JavaScript Object.values() Method: Syntax, Parameters & Examples
June 23, 2026 - Method JavaScript All modern browsers Updated June 23, 2026 ... The Object.values() method returns an array of an object's own property values.
🌐
Programiz
programiz.com › javascript › library › object › values
JavaScript Object.values() | Programiz
March 18, 2024 - The values() method, being a static method, is called using the Object class name. ... The values() method returns an array of strings that represents all the enumerable property values of the given object.
🌐
JavaScript Tutorial
javascripttutorial.net › home › javascript object methods › javascript object.values()
JavaScript Object.values() Method
May 8, 2024 - Object.values(obj);Code language: JavaScript (javascript) The Object.values() method accepts an object and returns its own enumerable property’s values as an array.
🌐
Vultr Docs
docs.vultr.com › javascript › standard library › object › values()
Get Object Values - JavaScript
November 6, 2024 - The values() method in JavaScript is a vital function when working with objects. It retrieves the values of properties in an object and returns them as an array.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Object › keys
Object.keys() - JavaScript - MDN Web Docs
4 days ago - This is the same as iterating with a for...in loop, except that a for...in loop enumerates properties in the prototype chain as well. The order of the array returned by Object.keys() is the same as that provided by a for...in loop. If you need the property values, use Object.values() instead.
🌐
Codecademy
codecademy.com › docs › javascript › objects › .values()
JavaScript | Objects | .values() | Codecademy
August 22, 2025 - Returns an array containing the values of an object’s own enumerable properties.
🌐
W3Schools
w3schools.com › js › js_arrays.asp
JavaScript Arrays
An Array is an object type designed for storing data collections. ... Elements: An array is a list of values, known as elements.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-convert-an-object-into-array-of-objects-in-javascript
How to Convert an Object into Array of Objects in JavaScript? - GeeksforGeeks
July 23, 2025 - Object.values() method extracts the property values of an object and returns them as an array, converting the original object into an array of objects.
🌐
JavaScript Tutorial
javascripttutorial.net › home › convert an object to an array in javascript
Convert an Object to an Array in JavaScript
March 29, 2020 - To convert property’s values of the person object to an array, you use the Object.values() method: