I see an awful lot of threads and articles while googling for a good equivalent to PHP's print_r() function for use in JavaScript - since you frequently need to dump an array or object for debugging purposes.
Instead of bundling in one of the countless (and limited) functions I've come across, the best approach I've seen at doing just this involves using Firebug's console. Let's face it: if you are a web developer: you are using Firebug already (if you aren't: what the hell is wrong with you?!).
It's incredibly simple. Let's say you want to dump the current object in a way that lets you see all its properties...
JAVASCRIPT CODE
console.log(this);
Simple eh?
Obviously, you'll want to substitute this with whatever the name of your array or object is, and the console pane in Firebug will show you what you are interested in. I am ashamed to say I just learned this today - this would have saved me loads of time if I knew it earlier. >_<