A function expression creates a function as a value, often unnamed, to assign, pass as a callback or invoke at once as an IIFE (Immediately Invoked Function Expression). Arrow functions (ES2015) are shorter: (x) => x * x returns its expression. They have no own this, arguments, super or new.target (The Function Object), cannot be called with new and cannot be generators. A braced body needs return, and an object literal needs parentheses.
const square = function (x) { return x * x; }; // function expression
const cube = (x) => x * x * x; // arrow: implicit return
const noBraces = (x) => { x }; // block body: returns undefined
const makePoint = (x, y) => ({ x, y }); // wrap an object literal in ( )
(function (msg) { console.log("IIFE", msg); })("runs at once");
console.log(square(3), cube(3), noBraces(3), makePoint(1, 2), square.name, cube.name);
try { new cube(); } catch (e) { console.log(e.message); }IIFE runs at once
9 27 undefined { x: 1, y: 2 } square cube
cube is not a constructorAnonymous functions still get a name inferred from their variable, which keeps stack traces readable.