-1

I have an array of object as below

const result = [
    { email: 'me@example.com' },
    { email: 'c@examples.com' }
];

Expected Output :

"me@example.com, c@examples.com"

How can i get the desired output?

Learning
  • 716
  • 1
  • 7
  • 13
  • this is a very basic question, you should be able to figure it out on your own – georg Apr 23 '21 at 10:16
  • it would duplicate question, anyway `result.map((v)=>{return v.email}).join(', ')` – Girish Apr 23 '21 at 10:17
  • Does this answer your question? [Perform .join on value in array of objects](https://stackoverflow.com/questions/16607557/perform-join-on-value-in-array-of-objects) – Girish Apr 23 '21 at 10:19

1 Answers1

1

enter image description hereresult.map(({email}) => email).join(', ')

iterate thru the array and join it.

elpmid
  • 872
  • 1
  • 6
  • 18