- #71
- 2,639
- 5,491
Not really a joke but still funny:
Did you know that
Did you know that
++[[]][+[]]+[+[]]
evaluates to the string "10" in Javascript?++[[]][+[]]+[+[]]
evaluates to the string "10" in Javascript?And/or horrifying. Yet strangely fascinating. I feel a bit like this is a prototype of the Enki virus from Snowcrash (Edit: Or was Inanna the virus and Enki the cure? Can't remember.)Not really a joke but still funny
So, trying to work this out:Did you know that++[[]][+[]]+[+[]]
evaluates to the string "10" in Javascript?
+[]
is a trick where an empty list is coerced into a zero, right? So it's ++[[]][0]+[0]
. And the zeroth element of the first list is an empty list, so it's ++[]+[0]
. Then the increment operator coerces the empty list to a zero and adds one to it, giving 1+[0]
which then turns into a "10" via string concatenation for some reason...?++0 would have been funnier...I recall someone asking for confirmation that one is true and zero is false in C, to which some genius replied "1".
Was that at the Foo bar?
It's funny because it's true.
Oh my gawd...Now I have stable wifi.