function fn() { console.log(typeof this == 'string'); } fn.call('str'); // consoler: true还是false?false!
why?
function fn() { console.log(this); } fn.call('str'); // String{0: "s", 1: "t", 2: "r"}
this是一个字符串包装对象。
function fn() { console.log(typeof this == 'string'); } fn.call('str'); // consoler: true还是false?false!
why?
function fn() { console.log(this); } fn.call('str'); // String{0: "s", 1: "t", 2: "r"}
this是一个字符串包装对象。
转载于:https://www.cnblogs.com/MyNameIsJim/p/3541376.html