Home My Account

Uncaught TypeError: Cannot read property of undefined

.Web Design
January 7, 2020

JavaScript TypeError is thrown when an operand or argument passed to a function is incompatible with the type expected by that operator or function. This error occurs in Chrome Browser when you read a property or call a method on an undefined object . There are a few variations of this error depending on the property you are trying to access. Sometimes instead of undefined it will say null.


function myFunc(inVar) {

  if (inVar === undefined) {



  return inVar;


var testVar;


When you run this code, you will get this message in browser:

Uncaught TypeError: Cannot read property 'not' of undefined

In basic terms, undefined means that a variable has been declared but has not yet been assigned a value. This particular error is probably easiest to understand from the perspective of undefined, since undefined is not considered an object type at all (but its own undefined type instead), and properties can only belong to objects within JavaScript.

In the above code, when you get undefined error , you need to make sure that whichever variables throws undefined error, is assigned a value to it.