1.16进制随机颜色 let color = '#'+Math.random().toString(16).slice(-6) 2.类型判断工具函数 function isType(target, type) { let targetType = Object.prototype.toString.call(target).slice(8, -1).toLowerCase() type = type.toLowerCase() return targetType === type } isTyp…
//类对象转成数组 var domNodes = Array.prototype.slice.call(document.getElementsByTagName("*")); var domNodes = Array.prototype.slice.call(arguments); 向下取整: var a = ~~1.2; //1 这个补充一下,还可以用位右移符>> var a = 3.4>>0; //3 但是两者最好都只用在正整数上,因为只是舍掉了小数部…