I read JS sources from Twitter - on my way to improve my JS knowledge base when I came across a strange way to call an anonymous function:
!function( $ ) { ... }( window.jQuery );
... and it works! :)
It is obvious to everyone that this:
function ( $ ) { ... } ( window.jQuery )
not working (syntax error) while this is true:
(function ( $ ) { .... })( window.jQuery )
Can someone explain this magic (why it works with !function )?
javascript anonymous-function
Konstantin Likhter Feb 01 2018-12-12T00: 00Z
source share