开发者

javascript: (ä=#1={}&&alert)(ä)

Found this here http://sla.ckers.org/forum/read.php?2,15812,page=2

If you copy the title of the question and run it in the browser you should see that it's alerting the string representation of a funct开发者_如何学JAVAion.

function alert() {
    [native code]

}

Could someone explain slowly what's going on?


Starting with what happens first and workout out from there

  1. {} && alert{} is true, so alert is evaluated and pushed left
  2. #1 = alert — assign alert to the variable #1 (technically, you aren't allowed to use # to start an identifier, but some browsers apparently let you get away with it (ditto ä))
  3. ä = #1 — assign #1 (alert) to ä
  4. ä(ä) — call alert with alert as an argument
  5. alert automatically calls theFirstArgument.toString() which turns the function into a string
  6. You then get the rendered string
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜