Back to JavaScript Errors
JavaScript Error

TypeError

Cannot read property of undefined

What does this error mean?

Occurs when trying to access a property or method on an undefined or null value.

How to fix TypeError?

Add null/undefined checks before accessing properties. Use optional chaining (?.) or provide default values.

Example
let obj = null; console.log(obj.property); // TypeError: Cannot read property 'property' of null