Ini bukan tantangan tetapi pertanyaan, saya pikir itu pada topik karena
Pertanyaan non-tantangan yang terkait dengan memecahkan teka-teki pemrograman atau jenis tantangan tertentu juga ada di topik.
Sekarang ke pertanyaan:
Mungkinkah menulis kode JavaScript hanya dengan 5 huruf? JSFuck sudah melakukan ini dengan 6 simbol !+[]()
tapi saya ingin tahu apakah !
karakter tersebut diperlukan.
JSFuck bekerja dengan kombinasi casting ke string (dengan menambahkan array kosong), casting ke angka (dengan menulis a + di depan) dan casting ke boolean dengan meniadakan. Sebagai contoh:
[] \\ Empty array
+[] \\ Cast to number -> 0
!+[] \\ Negate -> true
!+[]+[] \\ Cast to string -> "true"
Dari string ini kita dapat mengekstrak semua hurufnya menggunakan tanda kurung siku dengan angka di dalamnya, dan angka apa pun dapat dibuat dengan menambahkan true bersama sebanyak itu.
Seperti ini banyak surat dapat ditemukan dan dapat digabungkan ke string. String yang paling penting untuk dapat dibuat adalah "constructor"
karena dapat digunakan untuk mendapatkan Function
dari fungsi apa pun, dan objek ini dapat digunakan untuk mengeksekusi string sebagai JavaScript:
[]["find"] \\ the function Array.prototype.find
[]["find"]["constructor"] \\ the Function object
[]["find"]["constructor"](string)() \\ same as eval(string)
Seperti yang Anda lihat, !
ada 2 kegunaan di sini:
- Membuat angka untuk memilih huruf dari string.
- Casting ke boolean untuk mendapatkan
"true"
dan"false"
.
Yang pertama dari 2 ini juga dapat dilakukan dengan menggunakan ++
incrementor, tidak langsung aktif 0
, tetapi dapat digunakan pada elemen-elemen di dalam array:
+[] \\ 0
[+[]] \\ [0]
[+[]][+[]] \\ [0][0] -> 0
++[+[]][+[]] \\ ++[0][0]-> 1
++[[]][+[]] \\ also works because ++ casts to number
Jadi semua angka bisa dibuat tanpa !
.
Yang kedua lebih sulit. Pentingnya "true"
dan "false"
terletak dalam surat-surat "r"
dan "s"
, yang keduanya muncul di "constructor"
. Saya sudah menemukan semua huruf lain "constructor"
dengan cara "undefined"
, "Infinity"
, "NaN"
dan dengan casting fungsi untuk string.
Jadi pertanyaan terakhir: (Bagaimana) Anda bisa membuat boolean, atau huruf "r"
dan "s"
dalam JavaScript hanya dengan menggunakan +[]()
?
Surat itu "l"
mungkin juga membantu. Ini bisa didapat dari form null
tapi saya belum bisa mendapatkan nilai itu dengan 5 simbol tersebut. Misalnya dapat digunakan untuk mendapatkan boolean jika kita sudah memiliki "s"
:
[]["includes"]() \\ false
[+[]]["includes"](+[]) \\ true
Surat itu "l"
dan "k"
bersama - sama akan memberikan akses ke "r"
:
([]+[])["link"]() \\ "<a href="undefined"></a>"
Cara apa pun untuk mendapatkan boolean, null
atau surat apa r s l k
pun akan sangat berguna!
Perpustakaan yang kami miliki:
Array.prototype.find: [] [(([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] [+ []]) + (++ [[]] [+ []])]) + (([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + + ( ++ [[]] [+ []])]) + (([] [[]] + []) [++ [[]] [+ []]]) + (([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []])])]] Infinity: + ((++ [[]] [+ []] + []) + (([] [[]] + []) [(++ [[]] [+ []]) + + (+ + [[]] [+ []]) + (++ [[]] [+ []])]) + (++ [[]] [+ []] + []) + (+ []) + (+ []) + (+ [])) NaN: + [] [[]] tidak terdefinisi: [][[]] 0: + [] 1: ++ [[]] [+ []] 2: (++ [[]] [+ []]) + (++ [[]] [+ []]) 3: (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) 4: (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] ] [+ []]) 5: (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] ] [+ []]) + (++ [[]] [+ []]) 6: (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] ] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) 7: (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] ] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) 8: (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] ] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] [+ []]) 9: (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] ] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] [+ []]) + (++ [[]] [+ []]) a: (+ [] [[]] + []) [++ [[]] [+ []]] c: ([] [(([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] [+ []]) + (++ [[]] [+ []])]) + (([] [[]] + []) [(++ [[]] [+ [ ]]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [ []] [+ []])]) + (([] [[]] + []) [++ [[]] [+ []]]) + (([] [[]] + [] ) [(++ [[]] [+ []]) + (++ [[]] [+ []])]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []])] d: ([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []])]] e: ([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [ + []])] f: ([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [ + []]) + (++ [[]] [+ []])] i: ([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [ + []]) + (++ [[]] [+ []]) + (++ [[]] [+ []])]] n: ([] [[]] + []) [++ [[]] [+ []]] o: ([] [(([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] [+ []]) + (++ [[]] [+ []])]) + (([] [[]] + []) [(++ [[]] [+ [ ]]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [ []] [+ []])]) + (([] [[]] + []) [++ [[]] [+ []]]) + (([] [[]] + [] ) [(++ [[]] [+ []]) + (++ [[]] [+ []])]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []])] t: (+ ((++ [[]] [+ []] + []) + (([] [[]] + []) [(++ [[]] [+ []]) + + ( ++ [[]] [+ []]) + (++ [[]] [+ []])]) + (++ [[]] [+ []] + []) + (+ [] ) + (+ []) + (+ [])) + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ [] ])] u: ([] [[]] + []) [+ []] v: ([] [(([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] [+ []]) + (++ [[]] [+ []])]) + (([] [[]] + []) [(++ [[]] [+ [ ]]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [ []] [+ []])]) + (([] [[]] + []) [++ [[]] [+ []]]) + (([] [[]] + [] ) [(++ [[]] [+ []]) + (++ [[]] [+ []])]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + [] + ((++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] [+ []]))] y: (+ ((++ [[]] [+ []] + []) + (([] [[]] + []) [(++ [[]] [+ []]) + + ( ++ [[]] [+ []]) + (++ [[]] [+ []])]) + (++ [[]] [+ []] + []) + (+ [] ) + (+ []) + (+ [])) + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ [] ]) + (++ [[]] [+ []])] I: (+ ((++ [[]] [+ []] + []) + (([] [[]] + []) [(++ [[]] [+ []]) + + ( ++ [[]] [+ []]) + (++ [[]] [+ []])]) + (++ [[]] [+ []] + []) + (+ [] ) + (+ []) + (+ [])) + []) [+ []] N: (+ [] [[]] + []) [+ []] "": ([] [(([] [[]] + []) [(++ [[]] [+ []]) + + (++ [[]] [+ []]) + + (+ + [[]] [+ []]) + (++ [[]] [+ []])]) + (([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] [+ []])]) + (([] [[]] + []) [++ [[]] [+ []]]) + (([] [[]] + [ ]) [(++ [[]] [+ []]) + (++ [[]] [+ []])])] + []) [+ (++ [[]] [+ [] ] + [] + ((++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] [+ []]) + + (+ + [[]] [+ []]) + (++ [[]] [+ []])))]] (: ([] [(([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] [+ []]) + (++ [[]] [+ []])]) + (([] [[]] + []) [(++ [[]] [+ [ ]]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [ []] [+ []])]) + (([] [[]] + []) [++ [[]] [+ []]]) + (([] [[]] + [] ) [(++ [[]] [+ []]) + (++ [[]] [+ []])]] + []) [+ (++ [[]] [+ []] + [] + ((++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []])))]] ): ([] [(([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] [+ []]) + (++ [[]] [+ []])]) + (([] [[]] + []) [(++ [[]] [+ [ ]]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [ []] [+ []])]) + (([] [[]] + []) [++ [[]] [+ []]]) + (([] [[]] + [] ) [(++ [[]] [+ []]) + (++ [[]] [+ []])]] + []) [+ (++ [[]] [+ []] + [] + ((++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] [+ []])))] {: ([] [(([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] [+ []]) + (++ [[]] [+ []])]) + (([] [[]] + []) [(++ [[]] [+ [ ]]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [ []] [+ []])]) + (([] [[]] + []) [++ [[]] [+ []]]) + (([] [[]] + [] ) [(++ [[]] [+ []]) + (++ [[]] [+ []])]] + []) [+ (++ [[]] [+ []] + [] + ((++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []])))]] }: ([] [(([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] [+ []]) + (++ [[]] [+ []])]) + (([] [[]] + []) [(++ [[]] [+ [ ]]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [ []] [+ []])]) + (([] [[]] + []) [++ [[]] [+ []]]) + (([] [[]] + [] ) [(++ [[]] [+ []]) + (++ [[]] [+ []])]]] [[]) [+ ((++ [[]] [+ []] ]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + [] + ((++ [[]] [+ []]) + + ( ++ [[]] [+ []])))] .: (+ (++ [[]] [+ []] + [] + (++ [[]] [+ []]) + ([] [[]] + []) [(++ [ []] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []])] + (++ [[]] [+ [] ] + [] + (+ []) + (+ []))) + []) [++ [[]] [+ []]] ,:[[]] [([] [(([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] [+ []]) + (++ [[]] [+ []])]) + (([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + + ( ++ [[]] [+ []])]) + (([] [[]] + []) [++ [[]] [+ []]]) + (([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []])])] + []) [(++ [[]] [+ [ ]]) + (++ [[]] [+ []]) + (++ [[]] [+ []])] + ([] [(([] [[]] + []) [ (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [ + []])]) + (([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + + ( ++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []])]) + (([] [[]] ] + []) [++ [[]] [+ []]]) + (([] [[]] + []) [(++ [[]] [+ []]) + + (++ [[]] [+ []])])] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [ []] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []] )] + ([] [[]] + []) [++ [[]] [+ []]] + ([] [(([] [[]] + []) [(++ [[ ]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) ]) + (([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[]] ] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []])]) + (([] [[]] + []) [++ [[]] [+ []]]) + (([] [[]] + []) [(++ [[]] [+ []]) + + (++ [[]] [ + []])])] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []])] + (+ [] [[]] + []) [++ [[]] [+ []]] + (+ ((++ [[]] [+ []] + []) + (([] [[]] + []) [(++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []])]) + ( ++ [[]] [+ []] + []) + (+ []) + (+ []) + (+ [])) + []) [(++ [[]] [+ [] ]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + (++ [[]] [+ []]) + + (++ [[ ]] [+ []]) + (++ [[]] [+ []])]] ([[]]) + []
eval
2453 karakter dengan window
diizinkan.