What are the three types of errors I can expect in my JavaScript script?

HTMLJavascriptProgramming Scripts

The following are the three types of errors you can expect in JavaScript −

Syntax Errors

Syntax errors also called parsing errors, occur at compile time in traditional programming languages and at interpret time in JavaScript.

When a syntax error occurs in JavaScript, only the code contained within the same thread as the syntax error is affected and the rest of the code in other threads gets executed assuming nothing in them depends on the code containing the error.

Runtime Errors

Runtime errors, also called exceptions, occur during execution after compilation/interpretation. Exceptions also affect the thread in which they occur, allowing other JavaScript threads to continue normal execution.

Logical Errors

Logic errors can be the most difficult type of errors to track down. These errors are not the result of a syntax or runtime error. Instead, they occur when you make a mistake in the logic that drives your script and you do not get the result you expected.

You cannot catch those errors because it depends on your business requirement what type of logic you want to put in your program.

Published on 23-Feb-2018 12:06:51