I want to create a comma-separated list of items within an array.
For example:
[
{value: 1, text: 'one},
{value: 2, text: 'two},
{value: 3, text: 'three},
{value: 4, text: 'four},
]
I considered using Array.join (https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/join) - but this doesn't work with arrays containing more complex data, resulting in [object Object]
.
How can I extract and concatenate the values to achieve an output of one, two, three, four
?