0

I see this syntax of fb pixel code:

!function(...){
   // code
}(...);

I don't know what is this syntax to do, can anyone tell me?

roberrrt-s
  • 7,914
  • 2
  • 46
  • 57
Văn Quyết
  • 2,384
  • 14
  • 29
  • This is a self invoked function and it indicates the false of function's return value. – Manish Jangir Sep 06 '16 at 08:28
  • 1
    Possible duplicate of http://stackoverflow.com/questions/5827290/javascript-function-leading-bang-syntax – sokkyoku Sep 06 '16 at 08:28
  • 1
    @ManishJangir — "it indicates the false of function's return value" — No, it doesn't. While it does convert the return value to a boolean and invert it, the value is immediately discarded. That isn't what it is used for in that context. – Quentin Sep 06 '16 at 08:28
  • it's just convertation of statement to expression, same as `(function(){})()` – Maxx Sep 06 '16 at 08:30

0 Answers0