Reputation: 5053
I haven't worked in JS since 1999, so I'm quite rusty. I remember working in it in the past, and I was able to enable some kind of error reporting. Right now, when I have a syntax error in a script, no error is reported in the browser. Is there a directive or something to enable error reporting in a JS file?
Upvotes: 2
Views: 1340
Reputation: 536715
Most scripts in the wild are so full of crass errors that browsers don't bother complain about them any more.
In IE by default the error indicator in the left hand side of the status bar can be used to display the error. Or you can turn error alerts back on from Internet Options -> Advanced -> Browsing -> Display a notification about every script error, but that will make the rest of the internet unusably annoying.
In Firefox, Tools -> Error Console will bring back the familiar JavaScript console.
Upvotes: 4
Reputation: 490617
Browsers generally report errors in a non obtrusive way (probably because first JavaScript code written by amateurs was very buggy, plus end users (besides devs) don't know what to do with an error anyway).
Firebug for Firefox is great, and so is Web Inspector for Webkit. They both have a console you can print to using something like
console.log(str);
Upvotes: 1
Reputation: 12673
It's impossible to over-recommend the Firebug plugin for Firefox. It's become the de-facto standard for writing and debugging javascript. In the console panel of firebug, you'll find lots of errors and warnings you can toggle. In addition it allows inspecting dom elements, watching network timing, ajax calls, modifying html/css/and even adding code to live pages, in addition to a plugin system which allows a host of third-party utilities built on Firebug.
Upvotes: 1