New course! Every coder should learn Generative AI!
Try a free lesson0
The main difference between a function expression and a function declaration is the function name, which can be omitted in function expressions to create anonymous functions. A function expression can be used as an IIFE (Immediately Invoked Function Expression) which runs as soon as it is defined.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/function