Hi Pete
The two are in fact !function(){}() and (function(){})()
The first can be used where your immediately invoked function expression
doesn't return anything
However the second can be used when you do with to return a value.
Ben Alman's article may help you more.
http://benalman.com/news/2010/11/immediately-invoked-function-expression/
--
Rob Griffiths
Twitter: @bytespider
Github: https://github.com/bytespider
bytespider.euSent with Sparrow (http://www.sparrowmailapp.com/?sig)
On Tuesday, 27 September 2011 at 17:32, Pete wrote:
> Hi,
> could anyone explain me the difference in using "!" or ";" in front of
> "function() {}();"
>
> thanks
>
> pete
>
> //seen at
> https://github.com/twitter/bootstrap/blob/master/js/bootstrap-alerts.js
> !function( $ ){
> }( window.jQuery || window.ender );
>
>
> //seen at https://github.com/madrobby/keymaster/blob/master/keymaster.js
> ;(function(global){
> })(this);
>
> --
> To view archived discussions from the original JSMentors Mailman list:
> http://www.mail-archive.com/[email protected]/
>
> To search via a non-Google archive, visit here:
> http://www.mail-archive.com/[email protected]/
>
> To unsubscribe from this group, send email to
> [email protected]
> (mailto:[email protected])
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]