0
items: [{
        id: 1,
        name: 'apple'
    }, {
        id: 2,
        name: 'mango'
    }, {
        id: 2,
        name: 'strawberry'
    }]

And i want to access it like this -> var all = apple, mango, strawberry

Phil
  • 157,677
  • 23
  • 242
  • 245
Shoaib
  • 7
  • 4
  • 2
    `var all = whatever.items.map(({ name }) => name)` – Phil Jun 10 '20 at 06:34
  • 1
    what's the intent of var all = apple, mango, strawberry. where are you going to use that as in this eg all will hold the last value of after the comma. – Anks Jun 10 '20 at 06:34
  • 1
    I don't really understand what you are trying to achieve. Do you want each `name` inside your `items` array to be concatenated into a string separated by a comma? And if so, why? – manneJan89 Jun 10 '20 at 06:34
  • Please provide more details. It's too short string and too hard to understand what you want exactly. – WebDev Jun 10 '20 at 06:35

0 Answers0