Javascript Errors

What is a Javascript error ?

A javascript error is a problem encountered during the interpretation of the code by the user's browser. This code is generally intended to produce content or manage user interactions at the page level. An error can occur as a result of programming or browser compatibility errors.

Why is it important ?

When an error occurs, the execution of the rest of the instructions in this code is then interrupted, which can lead to more or less serious problems depending on the usefulness of the code. The content may be missing, the navigation in the site may no longer work, the interactions with the different elements of the page may not respond. In other words, javascript errors can greatly alter the user experience and make your content invisible to the crawlers eyes. 

How to fix Javascript errors

Make sure that there is not a bug in the scripts used and that they are compatible with the majority of browsers.

If the problem is in your code you must :

  • remember to note the errors displayed in the console
  • test and debug your code with the tools provided by the browsers
  • if you can't fix the problem, consider encapsulating it in a try {} catch(error) {}