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
๐ŸŒ
DEV Community
dev.to โ€บ awaisalwaisy โ€บ 7-ways-to-convert-objects-into-array-in-javascript-35m4
7 ways to convert Objects into Array in JavaScript - DEV Community
February 12, 2023 - The first method to convert a JavaScript object into an array is using Object.entries(). Object.entries() is a method available on all JavaScript objects that returns an array of arrays, where each inner array consists of a key/value pair from ...
Discussions

How might I extract the property values of a JavaScript object into an array? - Stack Overflow
Depending on your specific use ... fit to solving your problem. ... Save this answer. ... Show activity on this post. ... var result = []; var keys = Object.keys(myObject); for (var i = 0, len = keys.length; i < len; i++) { result.push(myObject[keys[i]]); } ... Save this answer. ... Show activity on this post. Object.values() method is now supported. This will give you an array of values of an object. ... Refer: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference... More on stackoverflow.com
๐ŸŒ stackoverflow.com
javascript - Converting object values and properties into an array - Stack Overflow
How to convert an object with names and values into an array of object just like the below format. 'result' : { "name1" : "Angle", "name2" : "Demon", "... More on stackoverflow.com
๐ŸŒ stackoverflow.com
How to sum multiple object with the same key in an array?
https://jsfiddle.net/dwo0dy7y/ It's not pretty, you could probably use Array.reduce to create something a bit prettier but I'm going to assume you're not familiar with all the Array methods and stick to basics. If you're feeling adventurous: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce?v=control More on reddit.com
๐ŸŒ r/learnjavascript
9
2
May 10, 2017
Best way to delete undefined values from an object
If you only want to remove the properties that are undefined, but null is ok, then use this: for (let key in person) { if(person[key] === undefined) { delete person[key] } } If you also want to remove properties that are null, then just remove the && person[key] !== null part. More on reddit.com
๐ŸŒ r/node
7
3
July 20, 2017
๐ŸŒ
JavaScript Tutorial
javascripttutorial.net โ€บ home โ€บ convert an object to an array in javascript
Convert an Object to an Array in JavaScript
March 29, 2020 - const propertyValues = Object.values(person); console.log(propertyValues); Copy ยท Output: [ 'John', 'Doe' ] Copy ยท To convert the enumerable string-keyed properties of an object to an array, you use the Object.entries() method.
๐ŸŒ
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.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ javascript โ€บ how-to-convert-object-to-array-in-javascript
How to Convert Object to Array in JavaScript? - GeeksforGeeks
August 5, 2025 - This example demonstrates how to use Object.keys() and map() to convert an object into an array of objects, where each object contains a key and value property.
๐ŸŒ
Rip Tutorial
riptutorial.com โ€บ convert object's values to array
JavaScript Tutorial => Convert object's values to array
Given this object: var obj = { a: "hello", b: "this is", c: "javascript!", }; You can convert its values to an array by doing: var array = Object.keys(obj) .map(function(key) { return obj[key]; }); console.log(array); // ["hello", "this is", ...
๐ŸŒ
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 - The Object.keys() and map() function are extracts keys and maps them to an array of objects using their corresponding values.
Find elsewhere
๐ŸŒ
SamanthaMing
samanthaming.com โ€บ tidbits โ€บ 76-converting-object-to-array
Converting Object to an Array | SamanthaMing.com
Array has an array of methods (sorry, bad pun ๐Ÿ˜). So by converting the object into an array, you have access to all of that. Woohoo ๐Ÿฅณ ยท const zoo = { lion: '๐Ÿฆ', panda: '๐Ÿผ', }; Object.keys(zoo); // ['lion', 'panda'] Object.values(zoo); // ['๐Ÿฆ', '๐Ÿผ'] Object.entries(zoo); // [ ['lion', '๐Ÿฆ'], ['panda', '๐Ÿผ'] ]
๐ŸŒ
Seanconnolly
seanconnolly.dev โ€บ javascript-object-to-array
JavaScript object to array ยท Sean Connolly
If not, then you most likely discovered the downsides to each of these options. ๐Ÿ˜• Object.keys strips out the data, which you most likely need. ๐Ÿ™ Object.values strips out the key, which you also probably need. โ˜น๏ธ Object.entries returns an array of arrays, which can be difficult to reason about.
๐ŸŒ
YouTube
youtube.com โ€บ watch
JavaScript Object to Array using Object.values, Object.keys and Object.entries - YouTube
In this video, we show you how you can take a JavaScript object and transform it into an array using JavaScript's in-built constructor Object. We cover calli...
Published: January 4, 2022
๐ŸŒ
LinkedIn
linkedin.com โ€บ pulse โ€บ 7-ways-convert-objects-array-javascript-awais-al-waisy
7 ways to convert Objects into Array in JavaScript
February 12, 2023 - To convert a JavaScript object into an array is by using the Array.from() method. The Array.from() method creates a new, shallow-copied Array instance from an array-like or iterable object.
๐ŸŒ
YouTube
youtube.com โ€บ code 2020
JavaScript tips โ€” Convert an object into an array of values, keys, or key-value pairs - YouTube
Turn any object into an array using #JavaScript's built-in functions.Use Object.values to get an array of values in an object.Use Object.key to get an array ...
Published: October 26, 2022
Views: 2K
๐ŸŒ
YouTube
youtube.com โ€บ shorts โ€บ EaEw3PU1bN4
Convert Object to Array in JavaScript: Quick & Easy Trick - YouTube
"In this short, learn how to quickly convert an object to an array in JavaScript with a simple method. Whether you're working with Object.keys(), Object.valu...
Published: October 23, 2024
๐ŸŒ
Favtutor
favtutor.com โ€บ articles โ€บ convert-object-to-array-javascript
Convert Object to Array in JavaScript (with code)
November 30, 2023 - The Object.values() method allows us to obtain the values corresponding to the keys of an object and store them in an array. This method was introduced in ES8 and is supported in modern browsers.
๐ŸŒ
Tutorial Reference
tutorialreference.com โ€บ home โ€บ javascript โ€บ examples โ€บ faq โ€บ how to convert an object to an array of its values in javascript
How to Convert an Object to an Array of its Values in JavaScript | Tutorial Reference
The Object.values() method is the most direct and idiomatic way to achieve this. It returns an array containing the values of the object's own enumerable properties, in the same order as a for...in loop.
๐ŸŒ
Medium
medium.com โ€บ chrisburgin โ€บ javascript-converting-an-object-to-an-array-94b030a1604c
Javascript, Converting an Object to an Array of Objects. | by Chris Burgin | Spark | Medium
December 16, 2017 - Today we are going to do the opposite, convert an object to an array of objects. You may be asking why, the answer is actually quite simple. In programing we are not always in control of the format in which our data is delivered to us. With this in mind it becomes important to understand how to convert our data into our desired format. Using newer Javascript features there is an easy one liner that can achieve this result using Object.values().
๐ŸŒ
ServiceNow Community
servicenow.com โ€บ community โ€บ developer-forum โ€บ please-suggest-how-to-convert-object-to-array-in-javascript โ€บ m-p โ€บ 2657108
Please suggest how to convert object to array in javascript
August 30, 2023 - To convert an ordinary object that's not iterable or array-like to an array (by enumerating its property keys, values, or both), use Object.keys() , Object.values() , or Object.entries() . To convert an async iterable to an array, use Array.fromAsync() .