Okay, so I& #39;m actually going to explain the other, better version, but it& #39;s basically the same thing:
(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]+!+[]+!+[]+!+[]+[]]+(![]+[])[+!+[]+!+[]+!+[]]
[Thread] 1/9 https://twitter.com/AllesHQ/status/1285538646733586432">https://twitter.com/AllesHQ/s...
(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[+!+[]+!+[]+!+[]+!+[]+[]]+(![]+[])[+!+[]+!+[]+!+[]]
[Thread] 1/9 https://twitter.com/AllesHQ/status/1285538646733586432">https://twitter.com/AllesHQ/s...
Let& #39;s deconstruct this, it& #39;s the combination of 5 parts, 5 letters:
(![]+[])[+!+[]] = "a"
(![]+[])[!+[]+!+[]] = "l"
(![]+[])[!+[]+!+[]] = "l"
(![]+[])[+!+[]+!+[]+!+[]+!+[]+[[]]] = "e"
(![]+[])[+!+[]+!+[]+!+[]] = "s"
2/9
(![]+[])[+!+[]] = "a"
(![]+[])[!+[]+!+[]] = "l"
(![]+[])[!+[]+!+[]] = "l"
(![]+[])[+!+[]+!+[]+!+[]+!+[]+[[]]] = "e"
(![]+[])[+!+[]+!+[]+!+[]] = "s"
2/9
Each part has the same first segment:
(![]+[]). What does it mean? If we run it in a javascript console, we get "false". As in, it& #39;s a string. JavaScript& #39;s type conversion is weird, but [] is a truthy value, so if we invert it using !, it will be false. Then if we add...
3/9
(![]+[]). What does it mean? If we run it in a javascript console, we get "false". As in, it& #39;s a string. JavaScript& #39;s type conversion is weird, but [] is a truthy value, so if we invert it using !, it will be false. Then if we add...
3/9
[] to it, it will become a string.
Let& #39;s look at some other examples of this:
"abc" + [] = "abc"
1 + [] = "1"
Concatenating something with an empty array turns it into a string.
So (![] + []) = (false + []) = "false"
4/9
Let& #39;s look at some other examples of this:
"abc" + [] = "abc"
1 + [] = "1"
Concatenating something with an empty array turns it into a string.
So (![] + []) = (false + []) = "false"
4/9
Now, have you noticed the key part yet? Alles contains the letters a, l, e and s. All of those letters are in the word false.
Since computers count from 0, if I have "false"[0], that& #39;s the first letter, "f". "false"[1] is "a", and so on.
5/9
Since computers count from 0, if I have "false"[0], that& #39;s the first letter, "f". "false"[1] is "a", and so on.
5/9
So if we think about it, this code really means:
"false"[1] + "false"[2] + "false"[2] + "false"[4] + "false"[3]
If you run that, you get "alles". But how do we get the numbers?
"false"[1] = (![]+[])[+!+[]]
+!+[] = 1
Here& #39;s where type conversion gets even weirder
6/9
"false"[1] + "false"[2] + "false"[2] + "false"[4] + "false"[3]
If you run that, you get "alles". But how do we get the numbers?
"false"[1] = (![]+[])[+!+[]]
+!+[] = 1
Here& #39;s where type conversion gets even weirder
6/9
If we put + before something, it will convert it to a number. If we put ! before something, it will convert it to the opposite boolean - a truthy value to false, and a falsy value to true.
So remember how we learnt earlier that ![] is false? Well +[] is 0.
7/9
So remember how we learnt earlier that ![] is false? Well +[] is 0.
7/9
Now if we invert 0, like !0, we get true.
!+[] = true
But then we can make true a number by prepending +.
+!+[] = 1
And therefore:
+!+[]+!+[] = 2
+!+[]+!+[]+!+[] = 3
+!+[]+!+[]+!+[]+!+[] = 4
So "false"[+!+[]] = "a"
"false"[+!+[]+!+[]] = "l"
and so on.
8/9
!+[] = true
But then we can make true a number by prepending +.
+!+[] = 1
And therefore:
+!+[]+!+[] = 2
+!+[]+!+[]+!+[] = 3
+!+[]+!+[]+!+[]+!+[] = 4
So "false"[+!+[]] = "a"
"false"[+!+[]+!+[]] = "l"
and so on.
8/9
So in conclusion
"a"
= "false"[1]
= (false + [])[1]
= (![] + [])[1]
= (![] + [])[+true]
= (![] + [])[+!false]
= (![] + [])[+!0]
= (![] + [])[+!+[]]
Then we just do that for every letter.
JavaScript is weird.
Thank you for coming to my TED talk.
9/9
"a"
= "false"[1]
= (false + [])[1]
= (![] + [])[1]
= (![] + [])[+true]
= (![] + [])[+!false]
= (![] + [])[+!0]
= (![] + [])[+!+[]]
Then we just do that for every letter.
JavaScript is weird.
Thank you for coming to my TED talk.
9/9