Skip to content

Extract array from object JavaScript | Exmaple code

  • by

The simplest thing to do would be to use map() to Extract an array from an object in JavaScript. Then you can loop through it or build a string from it as required.

Here is a shorter way of achieving it:

let result = =>;


let result ={ foo }) => foo)

Extract array from object JavaScript

Simple example code.

<!DOCTYPE html>

    var arr = [{"matchedKey":"cuisineType","cuisineType":"Indian","group":"group"},

    var cuisines = {
      return el.cuisineType;

  console.log(cuisines); // array
  console.log(cuisines.join(', ')); // formatted string



Extract array from object JavaScript

Extract Given Property Values from Objects as Array

Using a map() you can it.

    const objArray = [{a: 1, b: 2}, {a: 4, b: 5}, {a: 8, b: 9}];
    let res = => item['a']);

Do comment if you have any doubts or suggestions on this JS Array object topic.

Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version

Leave a Reply

Your email address will not be published. Required fields are marked *