What is the syntax for leading bang! in JavaScript function?

JavascriptWeb DevelopmentFront End Technology

To execute an anonymous function you need to use the leading bang! or any other symbol −

!function(){
   // do stuff
}();

You can also write it like −

+function(){
   // do stuff
}();

Even the following is an acceptable syntax −

~function(){
   // do stuff
   return 0;
}( );
raja
Published on 07-Feb-2018 13:30:51
Advertisements