3

Possible Duplicate:
What does the exclamation mark do before the function?

I ran across a function definition style that is new to me while browsing the Emile animation library:

!function () { // do something }(); 

I'm familiar with:

  • Function expressions: var foo = function (){}
  • Named function expressions: var foo = function bar(){}
  • Function declarations: function foo(){}
  • Immediate functions: var foo = function (){}() or var foo = (function (){})()

The snippet above uses immediate function invocation (for variable scoping, I assume), but the ! is what's throwing me off. JSLint is happy with it, so it must be kosher. What does it do?

0

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.