Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

191
Views
How to get list of map values in Javascript?

I have the following object:

var people = [
    {
        "name": "James",
        "work": "Shake Shack"
    },
    {
        "name": "Stanley Hudson",
        "work": "IBM"
    }
]

Is there an easy way built into Javascript to allow me to get a list of values by their key?

For exemple if I want a list like ["Shake Shack", "IBM"], which is all the values in the array associated with the work key, how can I do?

I know how to do this manually with a loop but I'd really like to know if there's some built-in functionality in Javascript that could do this for me.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try using Array.prototype.map :

var people = [
    {
        "name": "James",
        "work": "Shake Shack"
    },
    {
        "name": "Stanley Hudson",
        "work": "IBM"
    }
]

console.log(people.map((one) => one.work))

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!