摘要: 对所有浏览器而言,总的趋势是,一个标识符所在的位置越深,它的读写速度也就越慢。 如果某个跨作用域的值在函数中被引用一次以上,那么就把它存储到局部变量里。 function initUI(){ let doc = document, body = doc.body, links = doc.getEl 阅读全文
posted @ 2020-09-19 16:22 671_MrSix 阅读(157) 评论(0) 推荐(0) 编辑
摘要: function loadScript(url){ let xhr = new XMLHttpRequest() xhr.open('get',url,true) xhr.onreadystatechange = function(){ if(xhr.readyState == 4){ if(xhr 阅读全文
posted @ 2020-09-19 13:50 671_MrSix 阅读(300) 评论(0) 推荐(0) 编辑
摘要: function loadScript(url,cb){ let script = document.createElement('script') script.type = 'text/javascript' if(script.readyState){ script.onreadystatec 阅读全文
posted @ 2020-09-19 12:54 671_MrSix 阅读(162) 评论(0) 推荐(0) 编辑
摘要: Array.prototype.myIndexOf = function(ele,start = 0){ for(let i = start;i < this.length;i++){ let item = this[i] if(ele item){ return i } } return -1 } 阅读全文
posted @ 2020-09-19 11:33 671_MrSix 阅读(155) 评论(0) 推荐(0) 编辑