Coding Ninjas Logo

Home > JavaScript Questions > What are the different types of errors in JavaScript?

What are the different types of errors in JavaScript?

Answer:

There are 3 types of error in javascript.

  1. Runtime Errors
  2. Logical Errors
  3. Load Time Errors
  1. Runtime Errors :

    The error occurs during the runtime of the program(also called as 'exceptions').

       Example-
    <script type="javarscipt">

    //runtime error as there is no id with name 'form'
    document.getElemetById('#form');

    </script>

  2. Logical Errors :

    These error occurs because of a mistake in the program's source code.This results in unexpexted output or terminate abnormally.


  3. Load Time Errors :

    This type of error occur due to an error in the syntax. These errors are caught by javascript while loading the script. These error prevents the script from functioning. it occurs during the loading process ,javascript spots any errors which may cause the script to fail. To help determine the error javascript displays warning when a load time error occurs.


Similar Questions