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
{} && alert
—{}
is true, soalert
is evaluated and pushed left#1 = alert
— assignalert
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ä
))ä = #1
— assign#1
(alert
) toä
ä(ä)
— callalert
withalert
as an argumentalert
automatically callstheFirstArgument.toString()
which turns the function into a string- You then get the rendered string
精彩评论