文章目录
1
[].forEach.call($$("*"),function(a){a.style.outline="1px solid #" + (~~(Math.random()*(1<<24))).toString(16)})

[].forEach.call == Array.prototype.forEach.call
$$(“*“) == document.querySelectorAll(“*“)

parseInt(“ffffff”, 16) == 16777215

1 // 1 == 2^0
100 //4 == 2^2
10000 //16 = 2^4
1000000000000000000000000 // 16777216 == 2^24

1<<24 == 16777216

Math.random()*(1<<24) == 0 ~ 16777216

var a = 12.34, //~~a = 12
b = 1231.8754, //~~b = -1231
c = 3213.000001 //~~c = 3213

相当于

1
2
3
Array.prototype.forEach.call(document.querySelectorAll("*"),function(a){
a.style.outline="1px solid #" + parseInt(Math.random()*16777216).toString(16)
})

文章目录