We are assigning a variable value to the anonymous function object in the example below.
It's important to point out that this action makes the function cease to be anonymous - it will acquire the name of the variable:
// True anonymous function - no nameconsole.log((function(){}).name)// empty string - anonymous// Anonymous function assigned to a var// now had a name, not anonymousconstmyFunc=function(){}console.log(myFunc.name)// 'myFunc' - not anonymous any more
So, in your example, the variable name does not contain an anonymous function, rather a named one.
It's important to point out that this action makes the function cease to be anonymous - it will acquire the name of the variable:
So, in your example, the variable
namedoes not contain an anonymous function, rather a named one.More on anonymous functions here:
Most Developers Can't Answer This Question About Anonymous Functions 🤯
Jon Randy 🎖️ ・ Mar 27 '23