-5

As detailed, this line:

(! + [] + [] + ![])

Gives as result the string "truefalse"

I've been experimenting with it, but cannot fully grasp the implicit conversions happening, would like to know the reason behind the result.

Just curiosity.

panicDisco
  • 11
  • 1

1 Answers1

1
false       =>  ![]
true        =>  !![]
undefined   =>  [][[]]
NaN         =>  +[![]]
0           =>  +[]
1           =>  +!+[]
2           =>  !+[]+!+[]
10          =>  [+!+[]]+[+[]]
Array       =>  []
Number      =>  +[]
String      =>  []+[]
Boolean     =>  ![]
Function    =>  []["filter"]
eval        =>  []["filter"]["constructor"]( CODE )()
window      =>  []["filter"]["constructor"]("return this")()

You can find more about it at http://www.jsfuck.com/ .

Hacky
  • 34
  • 3