I was reading JS sources from Twitter — on my way to improve my JS knowledge base, when I came across the strange way of calling anonymous function:
!function( $ ) {
...
}( window.jQuery );
... and this works! :)
It's obvious to everyone, that this:
function ( $ ) { ... } ( window.jQuery )
does not work (Syntax error), while this one is correct:
(function ( $ ) { .... })( window.jQuery )
Can anyone please explain this magic (why case with !function
works)?