If (function foo(){}) is an expression due to the 'context' as "(Parenthesis)" are a grouping operator and grouping operator can only contain an expression.
Which leads to the question, can you declare a function inside of an IIFE or it would still count as an function expression?
The function itself becomes an expression if it is wrapped in parenthesis, because the parenthesis create an expression context.
This does not effect any of the statements or declarations in the function body whatsoever.
(function iife() {
function example() {
…
}
…
}());
Here, the literal for iife
is an expression because it's inside (…())
, but example
is a declaration as usual because it's part of a function body.