!function() { return false; } ()
我知道为什么你会写这样的东西, 但我有一个问题 关于它是如何工作的。据我所知,感叹标记有两件事:
- It acts on
function() { return false; }
, changing it into an expression - It also acts on the result of the executed function, so that the whole line evaluates to
true
所以,我的问题是:
- Is this the correct explanation?
- If it is correct, then since
()
binds more tightly than!
, how did the first part (the change of the function itself into an expression) happen? Why doesn t the exclamation mark act on the whole line throughout?