上一页 1 2 3 4 5 6 7 ··· 38 下一页
摘要: 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 阅读(29) 评论(0) 推荐(0)
摘要: ES5 严格模式 1、不允许使用with(){} 和arguments.callee() 2、变量必须声明并赋值 3、函数预编译this不是指向window 4、变量不允许重名 阅读全文
posted @ 2024-05-11 15:09 howhy 阅读(9) 评论(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 阅读(18) 评论(0) 推荐(0)
摘要: //圣杯模式 改变子属性不会影响父对应的属性 // function inherit(Target, Origin) { // function F() { } // F.prototype = Origin.prototype // Target.prototype = new F() // Ta 阅读全文
posted @ 2024-05-08 18:44 howhy 阅读(37) 评论(0) 推荐(0)
摘要: 1、一切未声明定义的变量(没有var)是全局变量属于window全局域 2、全局声明定义的变量是全局变量属于window全局域 function test() { var a = b = 123 } test() //console.log(a)//报错 a is not defined conso 阅读全文
posted @ 2024-05-07 14:59 howhy 阅读(10) 评论(0) 推荐(0)
摘要: class SuperTask { constructor(parallelCount = 2) { this.parallelCount = parallelCount this.tasks = [] this.ruuingCount = 1 } add(task1) { return new P 阅读全文
posted @ 2024-04-29 16:07 howhy 阅读(92) 评论(0) 推荐(0)
摘要: function arrany(name) { let tasks = [] tasks.push(() => { console.log(name) }) function wait(duration) { tasks.push(() => new Promise(resolve => { set 阅读全文
posted @ 2024-04-29 15:00 howhy 阅读(21) 评论(0) 推荐(0)
摘要: function _runtask(task,callback){ const startTime=Date.now() requestAnimationFrame(()=>{ if(Date.now()-startTime<16.6){ task() callback() }else{ _runt 阅读全文
posted @ 2024-04-28 18:43 howhy 阅读(10) 评论(0) 推荐(0)
摘要: class User { constructor(name, age) { this.name = name this.age = age } static print(age) { console.log(this.name + ' ' + age) } sayHello() { console. 阅读全文
posted @ 2024-04-28 17:35 howhy 阅读(10) 评论(0) 推荐(0)
摘要: function deepClone(obj) { if (typeof obj !== 'object' || obj null) { return obj } const result = Array.isArray(obj) ? [] : {} Object.setPrototypeOf(re 阅读全文
posted @ 2024-04-28 16:09 howhy 阅读(20) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 ··· 38 下一页