var sched = { a: function() { console.log('a'); return this; }, b: function() { console.log('b'); return this; }, c: () => { console.log('c'); return this; }, d: () => { console.log('d'); return this; }, }; sched.a().b().c().d(); // 调用d的时候报错 // 因为在箭头函数中this的固定指向 // Uncaught TypeError: sched.a(...).b(...).c(...).d is not a function
JavaScript之链式调用、this、箭头函数
关注
打赏