函数进行修改
2.
3. 解析:
comments是个数组 comment是个对象。
comments是数组,具体来说是json数组,而它的每个元素comment是json对象,并不是数组。既然是json对象,那么取值的方法有2种:comment.attribute或者comment['attribute']
属性有两种方式,即comment.attribute或者comment['attribute']。
但是一般的对象,引用其属性好像只能是comment.attribute这种形式吧。
我不知道对于json对象还可以这样引用comment['attribute']。我以为这样就是数组了。
这就是json区别于数组的地方,自有它的特殊性。