摘要: 一、极简promise雏形 function Promise(fn) { var value = null, callbacks = []; //callbacks为数组,因为可能同时有很多个回调 this.then = function (onFulfilled) { callbacks.push 阅读全文
posted @ 2026-01-27 22:03 chenlight 阅读(5) 评论(0) 推荐(0)
摘要: 一、forEach() 是什么? forEach() 是 JavaScript 数组的内置方法,用于遍历数组的每一个元素,并对每个元素执行你指定的回调函数。它的核心特点是: 遍历过程中无法被中断(不能用 break/continue,只能通过抛出异常终止); 没有返回值(默认返回 undefined 阅读全文
posted @ 2026-01-27 12:56 chenlight 阅读(5) 评论(0) 推荐(0)
摘要: 黑马程序员的B站课程:https://www.bilibili.com/video/BV1MN411y7pw?spm_id_from=333.788.videopod.episodes&vd_source=58cc5704c1268f656a4d51980dac6aa7&p=48 涉及回调地狱的代码 阅读全文
posted @ 2026-01-27 12:49 chenlight 阅读(3) 评论(0) 推荐(0)