TOP 10 JavaScript errors to be aware of

Home / Developer Tools / TOP 10 JavaScript errors to be aware of
TOP 10 JavaScript errors to be aware of

 

Originally, I’ve shared this article to Syndicode blog.

In this post, you will find the TOP 10 errors JavaScript errors to be aware of. I’m going to show you what causes them and how to prevent them from happening. If you will know these errors and will be able to handle them in the future it’ll definitely make you a better developer!

‘Rollbar’ did an interesting experiment. They’ve collected all the errors they faced and summarized how many times each one occurred. That helped to see the actual statistics with the most spread errors.

Here they are,

TOP 10 JavaScript errors to be aware of

  1. Uncaught TypeError: Cannot read property. This one occurs in Chrome when you read a property or call a method on an undefined object.
  2. TypeError: ‘undefined’ is not an object (evaluating). This is an error that occurs in Safari when you read a property or call a method on an undefined object.
  3. TypeError: null is not an object (evaluating). This is an error that occurs in Safari when you read a property or call a method on a null object.
  4. (unknown): Script error. The Script error occurs when an uncaught JavaScript error crosses domain boundaries in violation of the cross-origin policy.
  5. TypeError: Object doesn’t support property. This is an error that occurs in IE when you call an undefined method.
  6. TypeError: ‘undefined’ is not a function. This is an error that occurs in Chrome when you call an undefined function.
  7. Uncaught RangeError: Maximum call stack. This is an error that occurs in Chrome under a couple of circumstances.
  8. TypeError: Cannot read property ‘length’. This is an error that occurs in Chrome because of reading length property for an undefined variable.
  9. Uncaught TypeError: Cannot set property. When we try to access an undefined variable it always returns undefined and we cannot get or set any property of undefined.
  10. ReferenceError: event is not defined. This error is thrown when you try to access a variable that is undefined or is outside the current scope.

It turns out that a lot of these are null or undefined errors. A good static type checking system like Typescript can help you avoid them if you use the strict compiler option.

Anyway, you’d better read about all of these errors in details here.

Also, check myJS digests to know all the most popular recent repositories.

Source: https://dev.to/iriskatastic/top-10-errors-javascript-errors-to-be-aware-of–3hhf

Leave a Reply

Your email address will not be published.