【发布时间】:2014-06-10 03:05:45
【问题描述】:
我有一个for loop,它在 JSON 对象上运行并在控制台中返回属性。我要做的是在控制台中返回该属性的值。
这是代码
for (var i in response) {
console.log(i); //return the property to the console
}
如何获取response.i 的值而不仅仅是属性的名称?
【问题讨论】:
-
只需使用
console.log(response[i]); -
@adeneo 我确实不时缺少一些基本的东西......
标签: javascript json object for-loop properties