ES6箭头函数 this指向

箭头函数函数体内的this对象,就是定义时所在的对象,而不是使用时所在的对象。函数 例子this var foo = () => { console.log('箭头函数:', this.box) } var bar = function () { console.log('普通函数:', this.box) } var box = 10 foo.call({ box: 20 })
相关文章
相关标签/搜索