Home > Net >  How can I display these values with spaces to separate the words?
How can I display these values with spaces to separate the words?

Time:12-28

If I'll console.log(JSON.stringify(selected["1"]?.others)), this is what it shows:

["Cars","Books","Necklaces"]

However, displaying this in the screen, this will display all of the data, however, there are no spaces between each words. It shows like this

CarsBooksNecklaces

the others in selected["1"]?.others is an array.

This is what it looks like in firestore:

enter image description here

CodePudding user response:

Since this is an array of string values you could use join method like this:

selected["1"]?.others.join(' ')
  • Related