摘要: 关于 0.1+0.2 == 0.30000000000000004 //true 0.1+0.2 == 0.3 //false 19.9*100 == 1989.9999999999998 //true 19.9*100 == 1990 //false 解决 (0.1*10+0.2*10)/10 = 阅读全文
posted @ 2018-09-07 13:32 triz 阅读(170) 评论(0) 推荐(0) 编辑
摘要: Array.from(new Set(array)); [].slice.call(new Set(array)); 阅读全文
posted @ 2018-09-07 13:21 triz 阅读(187) 评论(0) 推荐(0) 编辑
摘要: NodeList.prototype.forEach = NodeList.prototype.forEach || function (callback) { for(let i = 0; i < this.length; i++){ callback.call(this[i],this[i],i) } }; 阅读全文
posted @ 2018-09-07 13:18 triz 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 1、匹配中文:[\u4e00-\u9fa5] 2、英文字母:[a-zA-Z] 3、数字:[0-9] 4、匹配中文,英文字母和数字及下划线:^[\u4e00-\u9fa5_a-zA-Z0-9]+$ 5、匹配中英文字母数字下划线及输入长度:[\u4e00-\u9fa5_a-zA-Z0-9_]{4,10} 阅读全文
posted @ 2018-09-07 13:17 triz 阅读(59) 评论(0) 推荐(0) 编辑