• Home
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Site Issues (NOT FOR DATABASE QUESTIONS)
  • Explore
  • Topics
  • Questions
  • Users
  • Badges
Skip to main content
    Faq
    JavaScript
    From an array of objects, extract value of a property as array

    From an array of objects, extract value of a property as array

    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().


    Related Questions

    Compare two dates with JavaScript

    How do I loop through or enumerate a JavaScript object?

    Is there a JavaScript equivalent of PHP’s “variable variables”?

    What is the (function() { } )() construct in JavaScript?

    How do I copy to the clipboard in JavaScript?

    Where can I find documentation on formatting a date in JavaScript?

    How do I redirect to another webpage?

    Sort array of objects by string property value

    Ways to circumvent the same-origin policy

    How do I convert an existing callback API to promises?

    Popular Topics

    alignment arrays centering centos 7 cron css docker dom html java javascript javascript date javascript selectors jdbc jquery json linux mysql nullpointerexception perl parse php php array php arrays php curl php mysql sort sql ssh string time
    View all

    Recent Languages

    •   HTML
    •   JAVA
    •   JavaScript
    •   Jquery
    •   Linux
    •   Mysql
    •   Perl
    •   PHP
    • View all
    Copyright 2024 HowProg.One Privacy Policy