3

I am currently learning Vue3. I am trying to access the values of the array inside an array to make a nice table. Then, those values will be separated by a comma.

Here is the link: https://stackblitz.com/edit/vue-chdcrt?

Expected output:

name | email | socialMedia

Ram | [email protected] | Weibo, Linkedln

3 Answers 3

1

You can just use array.join(character to split with) to convert the array of social medias into a string list. In this case it would be

<td>{{ info.socialMedia.join(', ') }}</td>

Project link

Sign up to request clarification or add additional context in comments.

Comments

1

to complete your goals you should use Array.join() method. Also, I strongly recommend you use MDN when looking for built-in methods.

In your case it will be look like:
<td>{{ info.socialMedia.join(', ') }}</td>

Comments

0

You can use join here to join array of strings as:

live DEMO

<td>{{ info.socialMedia.join(", ") }}</td>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.