Last I meet
!function () {
function a() {
some code here . . .
}
} ();
I know that "!" similar "not" negative particle, Everything work fine in this function, but I want know why in this case are used this "!" ??
THANKS!
Last I meet
!function () {
function a() {
some code here . . .
}
} ();
I know that "!" similar "not" negative particle, Everything work fine in this function, but I want know why in this case are used this "!" ??
THANKS!
It's an immediately-invoked function expression. Instead of (function(){})();
you can save a few bytes by using a unary operator: !function(){}();
, ~function(){}();
etc...
An immediately-invoked function expression – IIFE for short – is as the name suggests a function that is immediately invoked. Read more at Ben Alman