简体   繁体   English

如何显示没有索引的数组?

[英]How do I display array without the index?

I have an array from firestore that I have to put to events of full calendar. 我有一个来自Firestore的数组,必须将其放入完整日历的事件中。

What I want is to display it like this 我想要的是这样显示

[
 {
   title: '',
   start:''
 }
]

Not this 不是这个

[{…}]
0
:
{title: "namee", start: "2018-09-19"}
1
:
{title: "namee", start: "2018-09-19"}
2
:
{title: "STI Night", start: "2018-09-18"}
length
:
3
__proto__
:
Array(0)

You can use the third space parameter of JSON.stringify to pretty print your array. 您可以使用JSON.stringify的第三个space参数来漂亮地打印您的数组。 See the docs for JSON.stringify . 请参阅JSON.stringify 文档

 const a = [ { title: '', start: '' } ]; console.log(JSON.stringify(a, null, 2)); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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