摘要:
function myNew(constructor, ...args) { // 参数验证 if (typeof constructor !== 'function') { throw new TypeError('myNew: First argument must be a function' 阅读全文
posted @ 2025-11-26 15:53
howhy
阅读(5)
评论(0)
推荐(0)
摘要:
class MyPromise{ constructor(executor){ this.state='pending'; this.value=undefined; this.reason=undefined; this.onFulfilledCallbacks=[]; this.onReject 阅读全文
posted @ 2025-11-26 11:45
howhy
阅读(3)
评论(0)
推荐(0)
摘要:
1. Promise.all() 概念 等待所有 Promise 成功,或者任何一个 Promise 失败。 2. Promise.race() 概念 返回第一个 settled(完成或拒绝)的 Promise。 3. Promise.any() 概念 返回第一个成功的 Promise,如果所有 P 阅读全文
posted @ 2025-11-26 10:34
howhy
阅读(4)
评论(0)
推荐(0)
摘要:
let _curDependFun=null; class dependCls{ constructor(){ this.dependFuns=new Set(); } depend(){ _curDependFun && this.dependFuns.add(_curDependFun); } 阅读全文
posted @ 2025-11-26 09:34
howhy
阅读(3)
评论(0)
推荐(0)
摘要:
+ 运算符的双重角色 JavaScript 中的 + 运算符有两个主要功能: 数字加法 字符串拼接 类型转换规则 1. 基本规则 当使用 + 运算符时,JavaScript 遵循以下优先级: 如果任一操作数是字符串,进行字符串拼接 否则,尝试将两个操作数转换为数字进行加法运算 对象到原始值的转换过程 阅读全文
posted @ 2025-11-26 09:24
howhy
阅读(5)
评论(0)
推荐(0)

浙公网安备 33010602011771号