Tin mới
JavaScript: Scripting language
Web APIs: Programming interfaces
Structuring content with HTML module
Dynamic scripting with JavaScript module
The function keyword can be used to define a function inside an expression.
Note: An expression statement cannot begin with the keyword function to avoid ambiguity with a function declaration. The function keyword only begins an expression when it appears in a context that cannot accept statemen
The name of a formal parameter for the function. For the parameters' syntax, see the Functions reference.
If you want to refer to the current function inside the function body, you need to create a named function expression. This name is then local only to the function body (scope). This avoids using the deprecated arguments
If you want to refer to the current function inside the function body, you need to create a named function expression. This name is then local only to the function body (scope). This avoids using the deprecated arguments
Using a function as a callback
Using an Immediately Invoked Function Expression (IIFE)
Here, we introduce several use cases with examples.
Using an Immediately Invoked Function Expression (IIFE)
Here, we introduce several use cases with examples.
Here, we introduce several use cases with examples.
Using an Immediately Invoked Function Expression (IIFE)
Here, we introduce several use cases with examples.
This page was last modified on Aug 21, 2026 by MDN contributors.