I cannot imagine a case where a named functional expression cannot replace an anonymous function expression. Therefore, I would suggest calling a function if you are going to call it from the inside (i.e. if you are going to use recursion):
function myFunc(someArg) { ... ... myFunc(someNewArg); }
This works even if it is a link:
var myFunc = function(someArg) { ... }
If you don't want to pollute the namespace, you can even use recursive IIFE (immediately called function expression):
(function myFunc(arg) { ... myFunc(someOtherArg); })(0);
Also, something like this:
someOtherFunction(function myFunc(arg) { ... myFunc(otherArg); });
Also works and will not pollute the namespace.
Vivin paliath
source share