o3-2025-04-16· OpenAI
LMArena Human Preference 140K
What JS Array method would I use to take an array of objects and return an array with…
- User
What JS Array method would I use to take an array of objects and return an array with one specific property from each object?
- Assistant
The go-to method is Array.prototype.map().
const people = [ { name: 'Ada', age: 27 }, { name: 'Grace', age: 35 }, { name: 'Linus', age: 30 } ]; const names = people.map(person => person.name); // -> ['Ada', 'Grace', 'Linus']map creates a new array by running the callback on every element—in this case, pulling out the desired property.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.