これはチャレンジではなく質問です。
プログラミングパズルの解決や特定の種類の課題に関連する非チャレンジ型の質問もトピックに含まれています。
質問に今:
5文字だけのJavaScriptコードを書くことは可能ですか?JSFuckはすでに6つのシンボルでこれを行っています!+[]()
が、その!
キャラクターが必要かどうか疑問に思います。
JSFuckは、文字列へのキャスト(空の配列の追加による)、数値へのキャスト(前に+を書き込む)、および否定によるブール値へのキャストの組み合わせで動作します。例えば:
[] \\ Empty array
+[] \\ Cast to number -> 0
!+[] \\ Negate -> true
!+[]+[] \\ Cast to string -> "true"
この文字列から、内部に数字を含む角括弧を使用してすべての文字を抽出できます。また、何回でもtrueを加算することで、任意の数字を作成できます。
このように、多くの文字が見つかり、文字列に連結できます。作成できる最も重要な文字列"constructor"
はFunction
、任意の関数から取得するために使用でき、このオブジェクトを使用して文字列をJavaScriptとして実行できるためです。
[]["find"] \\ the function Array.prototype.find
[]["find"]["constructor"] \\ the Function object
[]["find"]["constructor"](string)() \\ same as eval(string)
ご覧のとおり、!
ここには2つの用途があります。
- 文字列から文字を選択する番号を作成します。
- をブール値にキャストして取得
"true"
し"false"
ます。
これら2つの最初の1つは++
、直接で0
はなく、インクリメンターを使用して行うこともできますが、配列内の要素で使用できます。
+[] \\ 0
[+[]] \\ [0]
[+[]][+[]] \\ [0][0] -> 0
++[+[]][+[]] \\ ++[0][0]-> 1
++[[]][+[]] \\ also works because ++ casts to number
したがって、すべての番号はなしで作成でき!
ます。
二番目はもっと難しいです。との重要性"true"
と"false"
レイアウトの文字"r"
と"s"
、両方に表示され"constructor"
ます。私はすでに、他のすべての文字を発見した"constructor"
手段によって"undefined"
、"Infinity"
、"NaN"
および文字列に関数をキャストすることによって。
(どのように)あなたがブール値、または文字を作成することができます究極の質問だから、"r"
と"s"
だけ使用してJavaScriptでは+[]()
?
手紙"l"
も役立つかもしれません。フォームnull
から取得できますが、これらの5つのシンボルでその値を取得することはできませんでした。たとえば、既に持っている場合はブール値を取得するために使用できます"s"
。
[]["includes"]() \\ false
[+[]]["includes"](+[]) \\ true
手紙"l"
と"k"
一緒にアクセスできるようになります"r"
:
([]+[])["link"]() \\ "<a href="undefined"></a>"
ブール値null
または文字のいずれかを取得する方法r s l k
は非常に便利です!
私たちが持っているもののライブラリ:
Array.prototype.find:[] [(([] [[]] + [])[(++ [[]] [+ []])+(++ [[]] [+ []])+ (++ [[]] [+ []])+(++ [[]] [+ []])])+(([[] [[]] + [])[(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+( ++ [[]] [+ []])])+(([[] [[]] + [])[++ [[]] [+ []]])+(([] [[]] + [])[(++ [[]] [+ []])+(++ [[]] [+ []])])] 無限大:+((++ [[]] [+ []] + [])+(([[]] [[]] + [])[(++ [[]] [+ []])+(+ + [[]] [+ []])+(++ [[]] [+ []])])+(++ [[]] [+ []] + [])+(+ []) +(+ [])+(+ [])) NaN:+ [] [[]] 未定義:[] [[]] 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個の文字にwindow
許可します。