摘要: const requestpromise = require("request-promise"); const crypto = require('crypto'); function md5(str) { const hash = crypto.createHash('md5'); hash.u 阅读全文
posted @ 2024-06-03 14:21 howhy 阅读(1) 评论(0) 推荐(0) 编辑
摘要: const pending = 'pending' const fulfilled = 'fulfilled' const rejected = 'rejected' class MyPromise { #state = pending #result = undefined #handler = 阅读全文
posted @ 2024-05-22 17:47 howhy 阅读(2) 评论(0) 推荐(0) 编辑
摘要: function batchRequest(urls,maxNum){ return new Promise(resolve=>{ if(urls.length 0){ resolve([]); return; } const results=[]; let index=0; let finishC 阅读全文
posted @ 2024-05-16 17:50 howhy 阅读(3) 评论(0) 推荐(0) 编辑
摘要: class SuperTask { constructor(parallelCount = 2) { this.parallelCount = parallelCount; this.tasks = []; this.runningCount = 0; } add(task) { return ne 阅读全文
posted @ 2024-05-16 17:34 howhy 阅读(2) 评论(0) 推荐(0) 编辑
摘要: js箭头函数特点: 1、不可以new 2、 没有原型prototype 3、没有arguments 4、 没有this 阅读全文
posted @ 2024-05-15 17:01 howhy 阅读(1) 评论(0) 推荐(0) 编辑
摘要: function debounce(fn, delay) { let timer; let tht = this; return function (...args) { clearTimeout(timer) console.log(...args) timer = setTimeout(() = 阅读全文
posted @ 2024-05-15 13:54 howhy 阅读(15) 评论(0) 推荐(0) 编辑
摘要: function getScrollSize(){ if(window.pageXOffset){ return { x:window.pageXOffset, y:window.pageYOffset } }else{ return { x:document.body.offsetLeft+doc 阅读全文
posted @ 2024-05-14 09:22 howhy 阅读(3) 评论(0) 推荐(0) 编辑
摘要: ES5 严格模式 1、不允许使用with(){} 和arguments.callee() 2、变量必须声明并赋值 3、函数预编译this不是指向window 4、变量不允许重名 阅读全文
posted @ 2024-05-11 15:09 howhy 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 类数组:属性为索引(数字字符串)属性,必须有length属性,最好加上push var obj = { '1': 'aa', '2': 22, 'length': 2, 'push': Array.prototype.push } // Array.prototype.push = function 阅读全文
posted @ 2024-05-10 12:12 howhy 阅读(1) 评论(0) 推荐(0) 编辑
摘要: //圣杯模式 改变子属性不会影响父对应的属性 // function inherit(Target, Origin) { // function F() { } // F.prototype = Origin.prototype // Target.prototype = new F() // Ta 阅读全文
posted @ 2024-05-08 18:44 howhy 阅读(3) 评论(0) 推荐(0) 编辑