Search

1/22/2011

JavaScript ( (__ = !$ + $)[+$] + ({} + $)[_/_] +({} + $)[_/_] )

JavaScript ( (__ = !$ + $)[+$] + ({} + $)[_/_] +({} + $)[_/_] )

$=[] is a blank array
$=[$=[]] is [[]]
$ equals to (number) 0, that is, +$ === 0
!$ equals to (bool)false
!$ + $ equals to (string)"false"
__ = !$ + $ equals to "false"
~ operator in JavaScript means -(N+1) so -~ equals +1
if $ = 0, then -~-~-~$ equals 3
thus _/_ equals 3/3 equals 1

(__ = !$ + $)[_ = -~-~-~$]
=> ("false")[_]
=> ("false")(3)
=> "s"

({} + $)[_/_]
=> ("object")[_/_]
=> ("object")[1]
=> "o"

$$ = ($_=!" + $)[_/_]
=> $$ = ("true)[1]
=> "r"

沒有留言: