HTML and CSS Reference
Figure 2.3 The output from Example 2.2 demonstrates the difference between the
document.write() and document.writeln() methods.
Have you ever tried to draw a picture or do your resume for the first time without a mis-
take either in the layout, order, type, style, or whatever? In any programming language,
doesn't turn out right. You might get errors on the console or get a totally blank page.
Finding errors in a script can get quite frustrating without proper debugging tools.
Before we go any further, this is a good time to get acquainted with some of the types of
errors you might encounter.
Load or Compile Time. Load-time errors are the most common errors and are
from running at all. Load-time errors are generally caused by mistakes in syntax, such
as missing parentheses in a function or misspelling a keyword. You might have typed a
string of text and forgotten to enclose the string in quotes, or you might have mis-
matched the quotes, starting with single quotes but ending with double quotes.
Runtime. Runtime errors, as the name suggests, are those errors that occur when the
your program references an object or variable that doesn't exist, or you put some code
between the <head></head> tags and it should have been placed within the
<body></body> tags, or you referenced a page that doesn't exist.
Logical. Logical errors are harder to find because they imply that you didn't antici-
pate an event or that you inadvertently misused an operator, but your syntax was okay.