This code is equal to alert(1)
, but how does it work ? I don't see eval
here.
/ㅤ/-[ㅤ=''],ᅠ=!ㅤ+ㅤ,ㅤㅤ=!ᅠ+ㅤ,ㅤᅠ=ㅤ+{},ᅠㅤ=ᅠ[ㅤ++],ᅠᅠ=ᅠ[ᅠㅤㅤ=ㅤ
],ᅠㅤᅠ=++ᅠㅤㅤ+ㅤ,ㅤㅤㅤ=ㅤᅠ[ᅠㅤㅤ+ᅠㅤᅠ],ᅠ[ㅤㅤㅤ+=ㅤᅠ[ㅤ]+(ᅠ.ㅤㅤ+ㅤᅠ)[ㅤ]+ㅤㅤ[ᅠㅤᅠ]+ᅠㅤ+ᅠᅠ+ᅠ
[ᅠㅤㅤ]+ㅤㅤㅤ+ᅠㅤ+ㅤᅠ[ㅤ]+ᅠᅠ][ㅤㅤㅤ](ㅤㅤ[ㅤ]+ㅤㅤ[ᅠㅤㅤ]+ᅠ[ᅠㅤᅠ]+ᅠᅠ+ᅠㅤ+"(ㅤ)")()
This is JSFuck, an esoteric programming language, that is actually valid JavaScript, so you don't need any special interpreter/compiler to run it.
The most popular one involves the use of just 6 characters ([]()!+
), but yours is a bit different since it also uses /
, =
, "
, '
, ,
, {
, }
and (blank).
It works by taking advantage of some nice features of JavaScript.
For instance, we know that []
is a truthy value, therefore ![]
yields false
.
With that same logic, we can get true
by executing !![]
.
Numbers can be achieved too. We know that false
is equal to 0
, so the following expression makes sense: 0 + false == 0
, right ? And it does. We know that false
can be written as ![]
, and we know that we can omit the 0
on the left-side of the expression: +![] == 0
.
Same can be said with true
and 1
: +!![]
The number 2
can be achieved by adding up two 1
s: (+!![])+(+!![])
, and so on.
With logic like these you can do pretty much anything.
For instance, a popular way to get the letter "a"
is by producing a NaN
result, converting it to string ("NaN"
), and then getting the letter at index 1
, which is "a"
.
Ok so.. We know we can get "alert(1)"
, but how do we execute this?
We can't use eval
, because that will require to use characters not allowed on JSFuck.
Well, the way most people do it is like this:
Array.prototype
, let's say indexOf
So, as a summary:
// You can try this on your browser!
[]["indexOf"]["constructor"]("alert(1)")()
We know that we can generate alphabetic characters on JSFuck, and we also know we can generate numbers, so that line of code up there is actually very possible.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With