Runtime vs. Compile time

Run time and Compile time are the words used by the developers while programming.

Compile-Time Errors

Errors that occur when you violate the rules of writing syntax. This compiler error indicates something that must be fixed before the code can be compiled otherwise it would not allow us to run the code. All these errors are detected by the compiler and thus are known as compile-time errors.
The most frequent Compile-Time errors are:

  • Missing Parenthesis ())
  • Printing the value of variable without declaring it
  • Missing semicolon (terminator)
function compiletimeError () {
    const a ='apple'
    const b= 'fruit'
    console.log(a + b
}

Here, we have the missing bracket ).

Error:  Uncaught SyntaxError: missing ) after argument list

Run-Time Error

Run time error are the errors which occurs after successful compilation. These type of error are hard to find at the time of compile time.
One of the most common run-time error is

function a () {
    const a = 0;
    const b = 1
    console.log(b/a)
}
Error: 
Infinity