这不是一个挑战,而是一个问题,我认为这是一个话题,因为
与解决编程难题或特定类型的挑战有关的非挑战性问题也在主题中。
现在开始问题:
是否可以仅用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个中的第一个也可以使用++
增量器完成,而不是直接在上完成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:(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[] ] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+ (++ [[]] [+ []])+(++ [[]] [+ []]) 一个:(+ [] [[]] + [])[++ [[]] [+ []]] c:([] [(([[[[]] + [])[(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])])(([[[[]] [[]] [[++ [ ]])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [ []] [+ []])])+(([[]] [+ []]])+(([[[] [[]] + [] )[(++ [[]] [+ []])+(++ [[]] [+ []])])] [[])[(++ [[]] [+ []]) +(++ [[]] [+ []])+(++ [[]] [+ []])] d:([[] [[]] + [])[(++ [[]] [+ []])+(++ [[]] [+ []])] e:([[[[]] + [])[(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [ + []])] f:([[[[]] + [])[(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [ + []])+(++ [[]] [+ []])] i:([[] [[]] + [])[(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [ + []])+(++ [[]] [+ []])+(++ [[]] [+ []])] n:([[[[]] + [])[++ [[]] [+ []]] o:([] [(([[[[]] + [])[(++ [[]] [+ []]))+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])])(([[[[]] [[]] [[++ [ ]])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [ []] [+ []])])+(([[]] [+ []]])+(([[[] [[]] + [] )[(++ [[]] [+ []])+(++ [[]] [+ []])])] [[])[(++ [[]] [+ []]) +(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])] t:(+((++ [[]] [+ []] + [])+(([[[[]] + [])[(++ [[]] [+ []])+( ++ [[]] [+ []])+(++ [[]] [+ []])])+(++ [[]] [+ []] + [])+(+ [] )+(+ [])+(+ []))+ [])[(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ [] ])] u:([[[[]] + [])[+ []] v:([[[(([[[]] + [])[(++ [[]] [+ []]))+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])])(([[[[]] [[]] [[++ [ ]])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [ []] [+ []])])+(([[]] [+ []]])+(([[[] [[]] + [] )[(++ [[]] [+ []])+(++ [[]] [+ []])])] [[])[(++ [[]] [+ []]) +(++ [[]] [+ []])+ [] +((++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []]))) y:(+((++ [[]] [+ []] + [])+(([[[[]] + [])[(++ [[]] [+ []])+( ++ [[]] [+ []])+(++ [[]] [+ []])])+(++ [[]] [+ []] + [])+(+ [] )+(+ [])+(+ []))+ [])[(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ [] ])+(++ [[]] [+ []])] I:(+((++ [[]] [+ []] + [])+(([[[[]] + [])[(++ [[]] [+ []])+( ++ [[]] [+ []])+(++ [[]] [+ []])])+(++ [[]] [+ []] + [])+(+ [] )+(+ [])+(+ []))+ [])[+ []] N:(+ [] [[]] + [])[+ []] “”:([[[[(([[[]] + [])[(++ [[]] [+ []]))+(++ [[]] [+ []])+(+ + [[]] [+ []])+(++ [[]] [+ []])])+(([[[[]] + [])[(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])])+(([[]] [+ []]])+(([[[] [[]] + [ ])[(++ [[]] [+ []])+(++ [[]] [+ []])])] [[])[+(++ [[]] [+ [] ] + [] +((++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(+ + [[]] [+ []])+(++ [[]] [+ []])))]] (:([[[[(([[[]] + [])[(++ [[]] [+ []]))+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])])(([[[[]] [[]] [[++ [ ]])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [ []] [+ []])])+(([[]] [+ []]])+(([[[] [[]] + [] )[(++ [[]] [+ []])+(++ [[]] [+ []])])] [[])[+(++ [[]] [+ []] + [] +((++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []]))))]] ):([] [(([[[[]] + [])[(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])])(([[[[]] [[]] [[++ [ ]])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [ []] [+ []])])+(([[]] [+ []]])+(([[[] [[]] + [] )[(++ [[]] [+ []])+(++ [[]] [+ []])])] [[])[+(++ [[]] [+ []] + [] +((++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []]))))] {:([[[[(([[[]] + [])[(++ [[]] [+ []]))+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])])(([[[[]] [[]] [[++ [ ]])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [ []] [+ []])])+(([[]] [+ []]])+(([[[] [[]] + [] )[(++ [[]] [+ []])+(++ [[]] [+ []])])] [[])[+(++ [[]] [+ []] + [] +((++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []]))))]] }:(([] [(([[[[]] + [])[(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])])(([[[[]] [[]] [[++ [ ]])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [ []] [+ []])])+(([[]] [+ []]])+(([[[] [[]] + [] )[(++ [[]] [+ []])+(++ [[]] [+ []])])+ [])[+(((++ [[]] [+ [] ])+(++ [[]] [+ []])+(++ [[]] [+ []])+ [] +((++ [[]] [+ []])+( ++ [[]] [+ []]))))] 。:((+(++ [[]] [+ []] + [] +(++ [[]] [+ []])+([[] [[]] + [])[(++ [ []] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])] +(++ [[]] [+ [] ] + [] +(+ [])+(+ [])))+ [])[++ [[]] [+ []]] ,:[[]] [([] [(([[[[]] + [])[(++ [[]] [+ []])+(++ [[]] [+ []])+ (++ [[]] [+ []])+(++ [[]] [+ []])])+(([[[[]] + [])[(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+( ++ [[]] [+ []])])+(([[] [[]] + [])[++ [[]] [+ []]])+(([[[[]] + [])[(++ [[]] [+ []])+(++ [[]] [+ []])])] + [])[(++ [[[]] [+ [ ]])+(++ [[]] [+ []])+(++ [[]] [+ []])] +([] [((([[[[[]] + [])[ (++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [ + []])])+(([[[[]] + [])[(++ [[]] [+ []])+(++ [[]] [+ []])+( ++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])])+(([[ ] + [])[++ [[]] [+ []]])+(([[[[]] + [])[(++ [[]] [+ []])+(++ [[]] [+ []])])+ [])[(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [ []] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []] )] +([[] [[]] + [])[++ [[]] [+ []]] +([] [((([[[[]] + [])[(++ [[ ]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []]) ])+(([[] [[]] + [])[(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[] ] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])])+(([[[[[]] + []) [++ [[]] [+ []]])+(([[] [[]] + [])[(++ [[]] [+ []])+(++ [[]] [ + []])])]] + [])[(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])] +(+ [] [[]] + [])[++ [[]] [+ []]] +(+(((++ [[]] [+ []] + [])+(([[[[]] + [])[(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])])+( ++ [[]] [+ []] + [])+(+ [])+(+ [])+(+ []))+ [])[(++ [[]] [+ [] ])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[]] [+ []])+(++ [[ ]] [+ []])+(++ [[]] [+ []])]]([[]])+ []
eval
了2453个字符的window
允许。