我不确定这行 javascript 中发生了什么:
alert( (''+[][[]])[!+[]+!+[]] ); // shows "d"
我发现了什么:
var a = ! + []; // == true
var b = ! + [] + ! + []; // == 2
似乎第二部分是对字母数组或某种类型的引用,但我不明白这是怎么来的
(''+[][[]])
还:
alert( (''+[][])[2] ); // nothing happens; console says "unexpected token ]"
alert( (''+[[]][])[2] ); // nothing happens; console says "unexpected token ]"
alert( (''+[[]][[]])[2] ); // shows "d"
alert( (""+true)[2] ); // shows "u"