Naming Function Expressions

Hey there, I just started the practice pack for JavaScript functions, and I am struggling with this question:

Select the INCORRECT option regarding JavaScript function expressions.

The correct answer, according to the quiz, is: JavaScript function expressions can be named.

This has me confused because according to my memory and the MDN documentation it is in fact possible to name function expressions. What am I missing?

Naming function expressions is rarely done, and if so with explicit intentions. In what situations would we want the name to be local to the function? Recursion in a method seems plausible, but outside of that we are not going to find a lot of use cases. This is definitely a topic that can be tabled to a much later date. Focus on the use cases of anonymous functions of which we will encounter a whole plethora in our early and later studies.

Thank you for clearing that up for me! But isn’t the answer still incorrect? No matter if it’s a topic for a much later date or not, it is possible to name function expressions. In my opinion the wording here is confusing for people who have heard about naming function expressions (e.g. from the MDN documentation or the recommended JavaScript & jQuery book).

1 Like

Is that the correct answer given in a quiz?

It is the correct answer to the question Select the INCORRECT option regarding JavaScript function expressions.

Gotcha. That statement, then, is debatable.

@catower, is this something that can be further investigated and perhaps revised?

Bottom line, we will never use named function expressions anywhere in these course modules. What need have we of them? In that sense, we may allow that it is not a convention we have to consider, so the above could be correct if we consider that named function expressions are never used.

Late afterthought… Notice that when we name the function in an object property scenario, we do not need to use this to recurse it?