Browser Console Errors – Are Browser Console Errors Compiler Errors or Runtime Errors?

compilerinterpretersjavascriptterminology

I was trying to communicate with a coworker about a JavaScript error I was being notified about in my browser's console window when I realized that I wasn't sure if I should refer to this as a compiler error or a runtime error; especially if said error is only popping up when, let's say, a certain button is clicked. Then I'd suspect that such an event is specifically a runtime error, but I'm not sure.

Maybe this gets into semantics and there's no formal definition, so let me know and I'll take this post down.


EDIT

This is a wonderful post that gives some insight into if JS is compiled or interpreted:

Is JavaScript interpreted by design?

Best Answer

If by compiler error, you mean syntax errors, then yes they are. Console also throws runtime errors. For example, trying to perform some action on null/undefined property.

JavaScript is an interpreted language. Therefore, we cannot call them compiler errors but instead parsing errors.

Browser console shows us the following:

  • Syntax errors at the time script is loaded and parsed.
  • Runtime errors (access an undefined property of some object)
  • Other warning messages (a deprecated method or property warning)
  • Console messages(console.log(), console.warn(), console.error())
  • Error messages with stack trace (Error())
Related Topic