- #71
- 3,328
- 8,845
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.)jack action said:Not really a joke but still funny
So, trying to work this out:jack action said: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...Ibix said: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?Wrichik Basu said:
It's funny because it's true.Wrichik Basu said:
Oh my gawd...Borg said:Now I have stable wifi.