Skip to main content
deleted 25 characters in body
Source Link
Ufuk Hacıoğulları
  • 38.6k
  • 14
  • 120
  • 157

It's a self invoking anonymous function or a function expression. It prevents you from creating variables in the global scope. You don't introduce a global variable for callingIt also calls the function right away.

function someFunc() { // creates a global variable } var someFunc = function () { // creates a global variable } (function(){ // creates an anonymous function and // runs it without assigning it to a global variable })(); 

It's a self invoking anonymous function or a function expression. It prevents you from creating variables in the global scope. You don't introduce a global variable for calling the function.

function someFunc() { // creates a global variable } var someFunc = function () { // creates a global variable } (function(){ // creates an anonymous function and // runs it without assigning it to a global variable })(); 

It's a self invoking anonymous function or a function expression. It prevents you from creating variables in the global scope. It also calls the function right away.

function someFunc() { // creates a global variable } var someFunc = function () { // creates a global variable } (function(){ // creates an anonymous function and // runs it without assigning it to a global variable })(); 
added 81 characters in body; added 140 characters in body; added 1 characters in body
Source Link
Ufuk Hacıoğulları
  • 38.6k
  • 14
  • 120
  • 157

It's a self invoking anonymous function or a function expression. It prevents you from creating variables in the global scope. You don't introduce a global variable for calling the function.

function someFunc() { // creates a global variable } var someFunc = function () { // creates a global variable } (function(){ // creates an anonymous function and  // runs it without assigning it to a global variable })(); 

It's a self invoking anonymous function or a function expression. It prevents you from creating variables in the global scope. You don't introduce a global variable for calling the function

function someFunc() { // creates a global variable } 

It's a self invoking anonymous function or a function expression. It prevents you from creating variables in the global scope. You don't introduce a global variable for calling the function.

function someFunc() { // creates a global variable } var someFunc = function () { // creates a global variable } (function(){ // creates an anonymous function and  // runs it without assigning it to a global variable })(); 
Source Link
Ufuk Hacıoğulları
  • 38.6k
  • 14
  • 120
  • 157

It's a self invoking anonymous function or a function expression. It prevents you from creating variables in the global scope. You don't introduce a global variable for calling the function

function someFunc() { // creates a global variable }