I was taking a look at some posts here on the site and I came across this question here . Well, in the accepted answer was explained the statement of expressions , anonymous, named and self-invoked . Causing my doubt in the named function. What is the name of the function for if the value of return
is in the name of the variable and not in the name of the function. What is the purpose of naming a function that is inside a variable?
//expressão anônima de função
var a = function() {
return 3;
}
//expressão nominada de função
var a = function bar() { // dúvida para que serve bar
return 3;
}
//expressão "autoinvocada" de função
(function digaOi() {
alert("Oi!");
})();