Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you debug Javascript applications?

I work in an application that is JavaScript intense. So to debug , I end up using many alerts. Are there other better ways to debug ? What methods do you use ?

like image 252
Vinoth Kumar C M Avatar asked Apr 07 '26 17:04

Vinoth Kumar C M


1 Answers

For JavaScript, debugging is a sinch in most browsers:

IE - Where you really need to debug, F12 is the console. You can call console.log, console.debug, console.error and a few others, and it will print out good data. When you call console.log on an object, good consoles will print out the property break-down of the object. There's also an active dom inspector so that you can see what's going on as the script is running.

  • Firefox - Get the Firebug addon. It is my favorite console of them all. Does everything I've ever dreamed of needing, and a few more features.
  • Chrome - Built-in console, inspect element on the page to see the breakdown of the DOM live.
  • Opera - Built-in console
  • Safari - Add Firebug Lite to the page, and you'll have a JS driven version of Firebug. Safari has built-in dev tools similar to Chrome, however they need to be enabled.

For all browsers, you can add Firebug Lite, but I really only use it for IE and Safari.

like image 58
zzzzBov Avatar answered Apr 10 '26 04:04

zzzzBov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!