Here is a list of the most common errors in JavaScript.
JavaScript Common Errors List
1.Uncaught TypeError: Cannot read property
Improper initialization of the state when reading the properties of an undefined object or calling its methods or rendering UI components will appear in the console
The simplest Solution: initialize state in the constructor.
2. TypeError: ‘undefined’ is not an object
An error occurred while reading a property or calling a method on an undefined object in safari.
3. TypeError: null is not an object
An error occurred while reading a property or calling a method on an empty object in Safari
Note: in JavaScript, null and undefined are different, which is why we see two different error messages. Undefined is usually a variable that has not been allocated, and null means the value is empty.
4. (unknown): Script error
This kind of script error occurs when an uncaught JavaScript error (an error caused by the window.oneror handler rather than captured in the try catch) is restricted by the browser’s cross domain policy.
5. TypeError: Object doesn’t support property
The error in ie when calling an undefined method is equivalent to the “typeerror:” undefined “isnotafunction” error in chrome.
6. TypeError: ‘undefined’ is not a function
This is an error in chrome when calling an undefined function.
7. Uncaught RangeError
This error occurs when calling a recursive function that does not terminate, or if you pass a value to a function that is out of range.
8. TypeError: Cannot read property ‘length’
An error occurred while reading the length attribute of an undefined variable.
9. Uncaught TypeError: Cannot set property
When accessing an undefined variable, it always returns undefined. We cannot get or set any undefined properties.
10. ReferenceError: event is not defined
This error is raised when a variable is undefined or is outside the current scope.
Read More:
- Uni-app Error when assigning a value to a component: [system] TypeError: Cannot read property ‘name‘ of undefined
- vue Error: Uncaught SyntaxError: Invalid shorthand property initializer
- How to Solve JS error: Unexpected end of JSON input,Unexpected token u in JSON at position 0
- [Solved] Binding onclick event in JS: for loop: error uncaught typeerror: cannot set properties of undefined (setting ‘classname’)
- JS uses onerror to automatically catch exceptions
- JS async await Error: Uncaught SyntaxError: await is only valid in async functions and the top level bodies of modules
- [Vue warn]: Error in render: “TypeError: Cannot read properties of undefined
- [Solved] JS Error: cannot set property xxx of undefined
- [Solved] react Chrome Browser Error: Uncaught TypeError: Cannot read properties of undefined (reading ‘forEach‘)
- [Solved] Uni.createintersectionobserver Error: Uncaught TypeError: Cannot read property ‘bottom’ of null
- JS bug Log Uncaught TypeError: Cannot read property ‘previoustSibling‘ of null
- [Solved] vue.esm.js?efeb:591 [Vue warn]: Error in event handler for “click“: “TypeError: Cannot read property
- [Solved] Vue element UI form verification error: cannot read property ‘validate’ of undefined
- [Solved] electron Error: Uncaught TypeError: Cannot read property ‘BrowserWindow‘ of undefined
- [Vue warn]: Error in render: “TypeError: Cannot read properties of undefined
- [Solved] layui table org.thymeleaf.exceptions.TemplateInputException: An error happened during template…
- [Solved] VS Code Debug JavaScript Error: “crbug/1173575, non-JS module files deprecated”
- [Solved] npm Error: Class extends value undefined is not a constructor or null
- [Solved] VUE Error: Error in mounted hook: “TypeError: Cannot read properties of undefined (reading ‘$on‘)“
- How to Test whether the property value of each property in the object is not empty