Javascript Anonymous Function Syntax Options

Possible duplicate:
Brackets for automatically executing anonymous JavaScript functions?
Are "(function () {}) ()" and "(function () {} ())" functionally equal in JavaScript?

I saw anonymous javascript functions written in two different ways:

(function(){

})();

and

(function(){

}());

I always believed that the top should be correct, and so far he had never met the bottom. I think this probably does not matter, but I thought I would be sure. Is there a difference between two or both equivalents?

+3
source share
2 answers

They are equivalent.

- - , , , .

. http://kangax.github.com/nfe/ .

+2

Oohh....... .....


, : (Twitter !)

!function(){

}();

. 1 . >


, :

(function(){

})();

:

(function(){

}());
0

All Articles