Fork me on github
摘要: Promise.all Promise.all().then() 适用于处理多个异步任务,且所有的异步任务都得到结果时的情况 场景:同一个页面,数据分别是从不同的后端接口获取的 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" 阅读全文
posted @ 2023-06-15 22:01 zjy4fun 阅读(194) 评论(0) 推荐(0) 编辑
摘要: const myObject = { foo: 'hello', func: function () { const self = this console.log(1, this.foo) console.log(2, self.foo) function a() { console.log(3, 阅读全文
posted @ 2023-06-15 21:18 zjy4fun 阅读(35) 评论(0) 推荐(0) 编辑
摘要: Promise.resolve 静态方法将给定值“解析”为 Promise。 如果值是 Promise,则返回该 Promise;如果值是 thenable,返回的 Promise 会“跟随”这个 thanable 的对象,采用它的最终状态;否则,返回的 promise 将以此值完成。 此函数将类 阅读全文
posted @ 2023-06-15 21:04 zjy4fun 阅读(1069) 评论(0) 推荐(0) 编辑
摘要: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <script> function func1() { console.log(1, this.val 阅读全文
posted @ 2023-06-15 20:38 zjy4fun 阅读(4) 评论(0) 推荐(0) 编辑