摘要:/** * insertAdjacentHTML * 支持 insertAdjacentHTML()方法的浏览器有 IE、Firefox 8+、Safari、Opera 和 Chrome */ var element = document.querySelector('#box2') //作为前一个同辈元素插入 element.insertAdjacentHTML("beforebegin...
阅读全文
摘要:深入理解DOM节点类型第六篇——特性节点Attribute
阅读全文
摘要:ajax前置处理实现异步请求session过期时跳转登录页面
阅读全文
摘要:1.JavaScript字符串 2.JavaScript数组 3.JavaScript对象
阅读全文
摘要:window.isFinite 如果 number 是有限数字(或可转换为有限数字),那么返回 true。否则,如果 number 是 NaN(非数字),或者是正、负无穷大的数,则返回 false
阅读全文
摘要:function hideProperty(host, name, value) { Object.defineProperty(host, name, { value: value, writable: true, enumerable: false, configurable: true }) } var ob...
阅读全文
摘要:jQuery JavaScript框架设计 我们再认真思考一下,既然我们是写框架,那么这些检测其实是放在 IIFE 里面,因此基本不用覆写,检测好哪个可用,就把它加到命名空间上就好了。最后的版本就出来了,使用new Function、eval,反正只用一次,耗不了多少性能
阅读全文
摘要:let getPrices = () => 4.55 console.log(getPrices()) let arr = ['apple', 'banana', 'orange'] arr.forEach(value => { console.log(value) }) arr.forEach((value, index) => { console.log(value, in...
阅读全文
摘要:var uid = 0 function nextUid() { return ++uid }
阅读全文