摘要: bind、call、apply 作用 都是为了修改执行函数的 this 指向。 区别 bind 只是修改了 this 的指向,没有立即执行,call 和 apply 会立马执行; call 和 apply 区别在于第二个参数,call 为多个参数展开,apply 的第二参数为一个数组。 实现手写 / 阅读全文
posted @ 2021-09-10 18:09 Tutao1995 阅读(30) 评论(0) 推荐(0) 编辑
摘要: // _Promise.js // 先定义三个常量表示状态 const PENDING = 'pending'; const FULFILLED = 'fulfilled'; const REJECTED = 'rejected'; function isFunction(fn) { return 阅读全文
posted @ 2021-09-10 10:50 Tutao1995 阅读(33) 评论(0) 推荐(0) 编辑