标签:div fine app color undefined join efi nodejs 作用
1 var scope = ‘globe‘ 2 function log() { 3 // console.log(this) 4 let arg = Array.prototype.join.call(arguments, ‘, ‘); 5 console.log(`${this.scope}: ${arg}`); 6 } 7 let obj = { 8 scope: ‘own‘, 9 lop: function() { 10 let scope = ‘scope‘; 11 log(‘low‘) 12 } 13 } 14 obj.lop(); // globe: low 15 obj.lop.call(obj); // globe: low 16 log.call(obj, ‘create‘) // own: create
如果把var scope= ‘globe’ 为 let scope = ‘globe’,结果就是
PS: 绑定this方法: call 参数是分开的,apply 参数是数组,bind 绑定this后修改this就没有作用了。
标签:div fine app color undefined join efi nodejs 作用
原文地址:https://www.cnblogs.com/wangtingnoblog/p/10408931.html