this指向问题 预计阅读 ... 分钟 字号中 沉浸阅读 123456789101112131415<script> class C1 { constructor() { window.setTimeout(function () { // 普通函数的this执行遵循谁调用指向谁的原则 console.log(this) }) window.setTimeout(() => { // 箭头函数没有this,会向上找this console.log(this) }) } } new C1()</script> ← 上一篇call,apply,bind问题 下一篇 →事件循环
读者来信
✎ 投递您的来信