[Vuejs]-Join nested array and output comma-separated list

2👍

You’ll want to map over your array to grab the text prop out of it and then apply the desired join.

const arr = [
  {value: 1, text: 'one'},
  {value: 2, text: 'two'},
  {value: 3, text: 'three'},
  {value: 4, text: 'four'}
];

const output = arr.map(el => el.text).join(', ');

console.log(output);
👤Nick

1👍

Found a solution:

{{array.map(x =>  x.text).join(', ')}}

Leave a comment