1
What callback is called in javascript when it is named (directly in the declaration)?
Example:
Joint declaration of a function:
function fn()
{
console.log(fn); // Imprime fn()
return 'do';
}
fn(); // 'do
Statement (I don’t know if that’s what it’s called) at the same time we go through callback:
call(function fn()
{
console.log(fn); // Imprime: fn()
});
fn(); // Erro: função não foi definida
Another example:
$('element').on('action', function fn()
{
if ($(this).next().size()) {
fn.call(this);
}
});
console.log(fn)// Erro: Função não definida
What is the difference this were of appointment of functions?
One is a statement and the other is an expression?
This can be called an anonymous function (since it has a name, even if it is only for that scope)?