简体   繁体   中英

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

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:

在此处输入图像描述

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM