1

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

2 Answers 2

10

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Also, you can set breakpoints - the code is paused when it gets to the breakpoint and you can start debugging from there. Useful if you're interested in some button event.
This is very awesome tool, I didn't know about it .. thank you thank you
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.