Search code examples
javascriptiife

where can I find out more on a type of javascript syntax?


What is this type of syntax called in javascript?

 (function(){})()

and this

  !function(){}()

I'd like to do a search to learn about them but I don't know what I'm searching for.

Also if anyone can provide link to a useful recourse that would be great.


Solution

  • This is the syntax for IIFE (Immediately Invoked Functions in Javascript).

    This is a great article that should clear all your doubts:

    http://benalman.com/news/2010/11/immediately-invoked-function-expression/