Skip to content
TheChatArchiveThe Chat Archive
o3-2025-04-16· OpenAIHugging Face LMArena Human Preference 140K

What JS Array method would I use to take an array of objects and return an array with…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Claudeclaude-sonnet-4-20250514-thinking-32k’s answer.
  1. 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?

  2. 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.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.