CHAPTER 13

image

Error Handling

An error is a mistake in the code that the developer needs to fix or handle. For instance, the following line of code triggers a syntax error because of a missing parenthesis.

console.log("Hi";

When an error is encountered, the browser halts execution of the script. Most browsers do not inform the user when an error occurs. Instead, information about the error can be found in the browser’s developer console. This information includes the filename, line number, and a description of the error, as the one seen below.

SyntaxError: missing ) after argument list

While syntax errors are easy to find and resolve, other errors ...

Get JavaScript Quick Syntax Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.