这样写 alert( typeof obj === "undefined" );
没有问题,弹出提示,结果是 true-----------------------------------------------------------
但是换个方式test(obj);function test(p){
alert( typeof p === "undefined" );
}结果是抛出异常 obj is undefined -----------------------------------------------------------谁能解释下原因?
没有问题,弹出提示,结果是 true-----------------------------------------------------------
但是换个方式test(obj);function test(p){
alert( typeof p === "undefined" );
}结果是抛出异常 obj is undefined -----------------------------------------------------------谁能解释下原因?
a = 10 ;
a = b ;//这里会报b is not defined你可以直接调用test()不传参数,看一下结果是不是和你想要的。