What is the good way to handle javascript?

I’ve been coding php and rather helpless when it comes to javascript.

Say we could use print_r() in php to show all data in an array or object. How do we do that in javascript?

What are the frequently used commands and firebug dom tool when it comes to troubleshooting javascript?

But that does work completely differently from the debuggers in all the other browsers whereas the Venkman one gives Firefox a debugger that works the same as all the other browsers already have built into them.

If you are using a debugger like Firebug or Venkman, you can use console.log(variableName) to pass that variable to the debugger.

A google search for

[indent]firebug tutorial[/indent] provides as the #1 result the following useful page:

Firebug Tutorial: Introduction To Firebug

I do have firebug, but am not so sure how to utilize it for javascript.

Is there any tutorials out there for this?

Is there any function that prints all values in an array? Seems like I’ll have to write loops to print values in arrays.

Lastly, how do I print values in objects? There are times I wish to print jquery object to see if my previous did capture the elements.

Or Firebug :slight_smile:

Actually the JavaScript debugger (not the console but the actual debugging tool) is just about identical across all the major browsers with just the positions of the buttons within the debugger varying between browsers. It is built into IE8, Safari, Chrome, and Opera and can be added to IE6 & 7 using the Developer Toolbar plugin and to Firefox by installing the Venkman extension.

Using the debugger you can set breakpoints in the script or step through it statement by statement and view the values in any variable prior to the next statement being executed.

Commonly a debug console is used. It’s different for each browser, but sending information to console.log() commonly results in the information being made available there.

Ctrl-Shift-J is a common shortcut for the javascript console in many web browsers, whereas in IE (it’s special) they use F12 for their developer tools.