aemkei / jsfuck

Write any JavaScript with 6 Characters: []()!+
jsfuck.com
Do What The F*ck You Want To Public License
8.07k stars 671 forks source link

Update README.md #109

Open kamil-kielczewski opened 3 years ago

kamil-kielczewski commented 3 years ago

More letters

hazzik commented 3 years ago

There are many ways to get these letters. Why this particular way?

kamil-kielczewski commented 3 years ago

@hazzik This trick is non-trivial and allows to get RegExp without using any deprecated or semi-deprecated method (like escape)

Function("return"+(NaN+""["matchAll"]("")).slice(10,17))()("pattern")

after partial expansion:

[]["flat"]["constructor"]("return"+[10]["concat"](17)["reduce"](""["slice"]["bind"]((NaN+""["matchAll"]("")))))()("pattern")

but may be better place will be "Alternatives" section (?)

hazzik commented 3 years ago

@kamil-kielczewski use split(" "):

Function("return "+(NaN+("")["matchAll"]()).split(" ")[1])
kamil-kielczewski commented 3 years ago

Yep so we have

[]["flat"]["constructor"]("return "+([]+("")["matchAll"]())["split"](" ")[1])()("pattern")