What are syntax errors in JavaScript?


Syntax errors also called parsing errors, occur at compile time in traditional programming languages and at interpret time in JavaScript. For example, the following line causes a syntax error because it is missing a closing parenthesis.

<script>
   <!--
      window.print(;
   //-->
</script>

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.  

Updated on: 16-Jan-2020

167 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements