javascript - Self Invoking functions difference -
this question has answer here:
what difference between these 2 self invoking functions? function not work if !
(not) symbol added.
please clarify if 1 has clear understanding.
// first (function( $ ) { // ... })( jquery ); // second !function($){ alert("test1"); }(jquery), function(){ alert("test2"); }(jquery);
!function () {}
meansnegative function
(similarif (!somevar) {}
), make sure result before making negative, function must executed.!
can replaced+
.you have wrong //second, because create 2 anonymous functions , between there
,
. think getting syntax error in place, next function not work (and not executed, because no 1 calling function)
Comments
Post a Comment