开发者

javascript debugging question

I have a large javascript which I didn't write but I need to use it and I'm slowely going trough it trying to figure out what does it do and how, I'm using alert to print out what it does but now I came across strange alert output:

[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

How can I get clear outputs from these object, any more relevant information , this doesn't really mean much to me or is there a better way to debug a javascript which someone could recommend it would be awesome ?开发者_如何学运维 thank you


One of the best ways of debugging javascript is using Firefox extension Firebug:

https://addons.mozilla.org/en-US/firefox/addon/1843

It has a step-by-step debugger and you can watch the value of any variable.


Yeah, the default toString() representation of JavaScript objects is woefully useless. Sometimes for native JS Objects you can get better results from explicitly calling toSource() on them in Firefox. But in general when you get to this point you want to be using a debugger instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜