【发布时间】:2016-03-30 17:34:29
【问题描述】:
我可能有一个非常简单的问题,但我需要知道如何做到这一点。 我的野心:
var test_obj = {
'test' : 't',
'test2' : 't2'
}
/*
when i log a object it often gives me somthing like this:
[object Object]
but if i want to take a look into the object, i want to see (for test_obj):
{ 'test' : 't', 'test2' : 't2' }
*/
那么我怎样才能记录一个对象,它向我展示了什么内容呢?
【问题讨论】:
-
你是如何记录它的?
-
JSON.stringify(test_obj) -
如果您使用的是 Chrome,您知道您可以通过在控制台上单击
object Object来展开它,对吧? -
@Wainage 得到错误:类型错误:将循环结构转换为 JSON
-
当我运行
console.log(test_obj);时,我得到了对象的详细信息(在 Chrome 中):Object {test: "t", test2: "t2"}
标签: javascript object console.log