Gandalf StormCrow
Gandalf StormCrow

Reputation: 26212

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

Upvotes: 2

Views: 168

Answers (2)

bobince
bobince

Reputation: 536765

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.

Upvotes: 0

rossoft
rossoft

Reputation: 2182

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.

Upvotes: 11

Related Questions