1

when I was writing code as below,it throw a error。

function(){}()

If I add '!' ,it will not .why?I'm confused。

!function(){}()

Jian Wang
  • 11
  • 3
  • what's the extra parenthesis for? –  Mar 06 '15 at 01:50
  • 2
    Because the first is a *function declaration* without the mandatory name, the second is a *function expression* where the name is optional. – RobG Mar 06 '15 at 01:51

0 Answers0