Three Types of Errors to Look For
- Loading Errors:
- Runtime Errors:
thispointer, will also cause a runtime error.
- Logic Errors:
The line number, in particular, turns out to be a lot less helpful than you
might expect. Browsers differ in their determination of the line number and
thus do not reliably report the correct line number that an error occurred at
in relation to the source code. Internet Explorer, for instance, reports the
line number in relation to the browser's own internal rendering of the document
source, which may or may not match the source file! Firefox reports the location
of the error more reliably, reporting the script file that an error occurred
in where applicable. Firefox will not however provide you with details about
the element that caused the error, known as the "caller". This information,
which can be useful in quickly tracing the cause of an error, is currently only
provided by Internet Explorer.
So what can you do with the line number? While not an exact science, it can help you pinpoint the general place in the script where things went awry. One easy trick is to copy the document source and paste it into a text editor that provides line numbering, such as Textpad. Alternatively, you can set the default HTML Editor on the
Programs tab of the
It can then be accessed from the
Common Browser Messages and What They Mean
generous! Here are some classics that you're bound to recognize:
"Object expected" ( or "[something] is undefined")
This two word message wins the award for most succinct. In any other language,
the phrase "object expected" would mean that a function was expecting
a loosely-typed language, it doesn't really make a distinction between objects
file, or have supplied a wrong path to the script. Specifically, it's saying
that a function being called or a variable being referred to is not available.
"Unterminated string constant"
To escape a character, precede it with a backslash(
"Expected ')' or missing ) after argument list"
This error is usually referring to an array or function arguments. It could mean that you left out a comma between array elements or inserted an unescaped apostrophe in an array element enclosed in single quotes. Here are three examples of incorrect array syntax: