What’s the differnce between
TypeError: ... is undefined
and
ReferenceError: ... is not defined
?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A
ReferenceErroroccurs when you try to use a variable that doesn’t exist at all.A
TypeErroroccurs when the variable exists, but the operation you’re trying to perform is not appropriate for the type of value it contains. In the case where the detailed message says “is not defined”, this can occur if you have a variable whose value is the specialundefinedvalue, and you try to access a property of it.See http://javascriptweblog.wordpress.com/2010/08/16/understanding-undefined-and-preventing-referenceerrors/ for some discussion related to this.