Console.log in IE on an object just outputted [object Object]

≯℡__Kan透↙ 提交于 2019-12-03 08:08:21

问题


I'm used to debugging JavaScript in Chrome or Firefox just because their built in developer tools are a lot cleaner than IE's. IE8 came along way with the Developer Tools being more polished, but they're still not completely up to snuff. I like being able to step through code as if I was in Visual Studio, and that is pretty nice about IE, however, when trying to do a simple console.log on an object that I have, in Firefox/Chrome/etc. I can actually explore that object.

In IE, the console is simply outputting the following:

LOG: [object Object]

Is there any way to drill down into that object in IE like in Chrome/Firefox/etc.?


回答1:


Maybe you can try what Xavi suggested here: How do I dump JavaScript vars in IE8?




回答2:


You might want to try:

console.log(JSON.stringify(foobarObject));



回答3:


Use:

console.dir(obj); 

This will will give you all properties of the object also in IE.




回答4:


Add the object to watch and you can see and analyze it completely from watch panel.



来源:https://stackoverflow.com/questions/2434613/console-log-in-ie-on-an-object-just-outputted-object-object

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!