JavaScript has several built-in error types:
TypeError: Wrong type (calling non-function)ReferenceError: Undefined variableSyntaxError: Invalid code structureRangeError: Number out of valid range
undefinedVar; // ReferenceError
null.method(); // TypeError
Each type tells you what category of problem occurred.