有什么差異呢
TypeError: ... is undefined
ReferenceError: ... is not defined
TypeError
值存在改基,但是操作方法不對,或者不存在這種方法
例如:
var a;
onsole.log(a.b); //Uncaught TypeError: Cannot read property 'b' of undefined
例如:
undefined.applay()//Uncaught TypeError: Cannot read property 'applay' of undefined
ReferenceError
當(dāng)你嘗試使用一個不存在的變量
例如:
console.log(abc) //ReferenceError: abc is not defined
關(guān)鍵字 和 保留字
var void = function(){}
void()
//Uncaught SyntaxError: Unexpected token void