随笔分类 -  javascript

摘要:(async () => { const fetchData = () => { return new Promise((resolve, reject) => { setTimeout(() => { resolve('fetch data is me') }, 1000) }) } // 抽离成 阅读全文
posted @ 2023-02-03 10:05 laiyaoWeb 阅读(13) 评论(0) 推荐(0)
摘要:实现一个类 const boy = new PlayBoy('Tom'); boy.sayHi().sleep(1000).play('王者').sleep(2000).play('跳一跳') // 输出 // 大家好我是Tom // 1s 之后 // 我在玩王者 // 2s 之后 // 我在玩跳一 阅读全文
posted @ 2023-02-03 10:05 laiyaoWeb 阅读(69) 评论(0) 推荐(0)
摘要:const globalThis = typeof window !== 'undefined' ? window : global; Function.prototype.myCall = function (context, ...args) { if (typeof this !== 'fun 阅读全文
posted @ 2023-02-03 10:05 laiyaoWeb 阅读(16) 评论(0) 推荐(0)