Array.prototype.map can be used to map one array to another.

var names = employees.map(function(i) {
  return i.name;
});

names is now an array containing the name-properties of the objects.

Answer from phylax on Stack Overflow
Discussions

Get single object from array using JavaScript functions - Stack Overflow
Bring the best of human thought and AI automation together at your work. Explore Stack Internal ... Closed 9 years ago. ... var frequencies = [{id:124,name:'qqq'}, {id:589,name:'www'}, {id:45,name:'eee'}, {id:567,name:'rrr'}]; I need to get an object from the array above by the id value. For example I need to get the object with id = 45. ... But I didn't get the desired object. How can I implement it using JavaScript ... More on stackoverflow.com
🌐 stackoverflow.com
Find a single value in array of objects in JavaScript - Stack Overflow
I'm a noob when it comes to JS and am trying to figure out how to return a single value instead of an object when using the .find() function. More on stackoverflow.com
🌐 stackoverflow.com
javascript - A simpler way of getting single key and single value in array of objects? - Stack Overflow
0 Get value by key from array of array - Javascript · 0 if object has key from different array object key value, return only that key · What is unique about Tzaraat if all suffering is a function of sin? ... How do U.S. judges decide which of very many cases to cite in their opinions? How do scholars interpret the single... More on stackoverflow.com
🌐 stackoverflow.com
How to get only one value in Javascript array of objects using for of and for in statements? - Stack Overflow
Connect and share knowledge within a single location that is structured and easy to search. Learn more about Teams ... Here is my array of objects, where I want to get specific value. More on stackoverflow.com
🌐 stackoverflow.com
May 9, 2020
🌐
YouTube
youtube.com › hey delphi
Array : Javascript Array of objects get single value - YouTube
Array : Javascript Array of objects get single valueTo Access My Live Chat Page, On Google, Search for "hows tech developer connect"As promised, I have a sec...
Published   May 5, 2023
Views   1
🌐
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 - The forEach() method is used to iterate through each element of an array and execute a provided function. It does not return a new array, but it's helpful when you want to operate on each element without modifying the original array.
Find elsewhere
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › find
Array.prototype.find() - JavaScript - MDN Web Docs
The find() method of Array instances returns the first element in the provided array that satisfies the provided testing function. If no values satisfy the testing function, undefined is returned.
🌐
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.
🌐
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 - To solve this problem, we can use various techniques such as looping through the array, built-in array methods, or third-party libraries. In this topic, we will explore different approaches to find a value in an array of objects in JavaScript.
🌐
freeCodeCamp
forum.freecodecamp.org › javascript
Getting single object from array in constructor - JavaScript - The freeCodeCamp Forum
May 27, 2021 - With the Fetch get function i have put all the data in a array that is located in the constructor and with the “map” function i can display them all one by one but now i would like to get a single object from a array This is what i have ...
🌐
Go Make Things
gomakethings.com › how-to-find-a-single-item-in-an-array-with-vanilla-js
How to find a single item in an array with vanilla JS | Go Make Things
November 19, 2018 - The Array.find() method is a super useful ES6 method that returns the first item an array that matches some criteria you specify. If not match is found, it returns undefined. How it works In the callback function, you define an argument variable ...
🌐
freeCodeCamp
forum.freecodecamp.org › t › how-do-i-return-a-single-value-from-a-for-loop-over-an-array-of-objects › 166680
How do I return a single value from a for loop over an array of objects? - The freeCodeCamp Forum
January 4, 2018 - I currently have a for loop with the var i increasing over the length of the array of objects. Console.logging it returns the entire array of objects, but I just want a random single value. I have got the for loop to ret…
🌐
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:
Top answer
1 of 8
82

I know this question is old, but no one has mentioned a native solution yet. If you're not trying to support archaic browsers (which you shouldn't be at this point), you can use array.filter:

var arr = [];
arr.push({name:"k1", value:"abc"});
arr.push({name:"k2", value:"hi"});
arr.push({name:"k3", value:"oa"});

var found = arr.filter(function(item) { return item.name === 'k1'; });

console.log('found', found[0]);
Check the console.
Run code snippetEdit code snippet Hide Results Copy to answer Expand

You can see a list of supported browsers here.

In the future with ES6, you'll be able to use array.find.

2 of 8
53

Arrays are normally accessed via numeric indexes, so in your example arr[0] == {name:"k1", value:"abc"}. If you know that the name property of each object will be unique you can store them in an object instead of an array, as follows:

var obj = {};
obj["k1"] = "abc";
obj["k2"] = "hi";
obj["k3"] = "oa";

alert(obj["k2"]); // displays "hi"

If you actually want an array of objects like in your post you can loop through the array and return when you find an element with an object having the property you want:

function findElement(arr, propName, propValue) {
  for (var i=0; i < arr.length; i++)
    if (arr[i][propName] == propValue)
      return arr[i];

  // will return undefined if not found; you could return a default instead
}

// Using the array from the question
var x = findElement(arr, "name", "k2"); // x is {"name":"k2", "value":"hi"}
alert(x["value"]); // displays "hi"

var y = findElement(arr, "name", "k9"); // y is undefined
alert(y["value"]); // error because y is undefined

alert(findElement(arr, "name", "k2")["value"]); // displays "hi";

alert(findElement(arr, "name", "zzz")["value"]); // gives an error because the function returned undefined which won't have a "value" property
🌐
xjavascript
xjavascript.com › blog › get-javascript-object-from-array-of-objects-by-value-of-property
How to Get a JavaScript Object from an Array of Objects by Property Value (Without Using Loops) — xjavascript.com
Retrieving an object from an array by property value is a staple task in JavaScript, and modern methods eliminate the need for manual loops. Use Array.prototype.find() for most cases: it’s efficient, readable, and designed explicitly for finding ...
🌐
DigitalOcean
digitalocean.com › community › tutorials › js-array-find-method
Using the Array.find Method in JavaScript | DigitalOcean
September 9, 2020 - So if you only need a single value, use find()! When you need to find/return multiple values, reach for filter() instead. Using find() is super easy! The only required parameter of this method is a testing function, and it can be as simple or complex as needed.