Comprehensive Guide
A Function Expression allows us to create a function in the middle of any expression. It is often assigned to a variable using const or let.
const multiply = function(x, y) { return x * y; };
Why use Expressions?
- Closures: Easier to limit function scope.
- Callbacks: Can be passed directly into methods like
.map()or.filter(). - IIFEs: Can be used to create Immediately Invoked Function Expressions.