function test(){ if(this === null){ console.log("This is null"); }else{ console.log("This is Object"); } } test.call(null); test.call({});
输出:
This is Object. This is Object.
This is Object.
但我期望的输出是:
This is Null. This is Object.
This is Null.
为什么空值没有设置为上下文?
用户名或电子邮箱地址
密码