JavaScript的240 228
首次提交:
z=(!1+"")[1];y=(!!1+"")[3];x={}+"";w=x[1];v=x[2];u=z+"t"+w+v;1[_="c\157nstruct\157r"][_](z+'l'+y+'rt('+u+'("Iy\x51lJj"+'+(t=u+'("\x51\x51==")')+'+'+u+'("M"+'+t+'+"==")+"Nj"+'+u+'("Zw==")+"5\x51EFC\x52E\71\x51UVJhYm\x52lZ2\71wc\x51=="))')()
现在,这是一个很好的开始,下面是它的分解方法...
z=(!1+"")[1]; // assigns "a" to z, !1+"" === "false"
y=(!!1+"")[3]; // assigns "e" to y, !!1 === "true"
x={}+""; // assigns "[object Object]" to x
w=x[1];v=x[2] // assigns "o" to w, and "b" to v
u=z+"t"+w+v; // creates the mystical "atob" command, yes, I'm gonna use it!
1[_="c\157nstruct\157r"][_] // sets up the primitive to a number object... this acts similar to the "window" primitive object so that I can play off functions...
z+'l'+y+'rt( // starts creating an alert call
'+u+'("Iy\x51lJj"+'+(t=u+'("\x51\x51==")')+'+'+u+'("M"+'+t+'+"==")+"Nj"+'+u+'("Zw==")+"5\x51EFC\x52E\71\x51UVJhYm\x52lZ2\71wc\x51=="))')()
// Above line abuses atob command with a couple of nested instances of the command, also using hex and octal equivalents of characters
然后我想...“一定有更简单的方法...”
修改后的提交:
z=(!1+"")[1];y=(!!1+"")[3];x={}+"";w=x[1];v=x[2];u=z+"t"+w+v;this[y+"v"+z+"l"](z+'l'+y+'rt('+u+'("Iy\x51lJj"+'+(t=u+'("\x51\x51==")')+'+'+u+'("M"+'+t+'+"==")+"Nj"+'+u+'("Zw==")+"5\x51EFC\x52E\71\x51UVJhYm\x52lZ2\71wc\x51=="))')
看到我可以使用eval
(将它们拼凑起来,从@bebe那里得到灵感;比使用constructor
a constructor
的a 更快number
),我将其向下钻取到228 ...我知道它可能无法赢得这个特殊的高尔夫挑战赛,但这只是我展示您可以滥用JavaScript多少并仍然获得预期结果的方式...