liveBook · Manning

Function expression

A function expression is an expression that creates a function value, which can be assigned, passed, or used within another expression.

How 2 Manning books explain it

Secrets of the JavaScript Ninja, Third Edition

A function expression is a JavaScript expression that creates a function and occurs as part of another expression or statement.

How it is used
Creates functions where values are needed, such as assignments, arguments, and return values.
How deep it goes
Defines expression placement through examples and contrasts it with declarations; defers detailed scope and identifier resolution.
Examples
Shows anonymous functions assigned to variables, passed as arguments, returned from functions, and called immediately.
What you can do after
Build it from scratch: place a function expression in an assignment, argument, return statement, or immediate call.

Read how Secrets of the JavaScript Ninja, Third Edition explains function expression →

Secrets of the JavaScript Ninja, Second Edition

A function defined as an expression rather than a declaration, producing a function value that can be assigned or passed around.

How it is used
Treats functions as first-class values that can be assigned, passed, or returned, while distinguishing expressions from declarations.
How deep it goes
Defines expression placement and naming, then flags invocation-availability differences without detailing them here.
Examples
Uses assignment to a variable, passing a function as an argument, returning a function, and immediate invocation.
What you can do after
Understand function expressions as values that can be assigned, passed as arguments, and returned.

Read how Secrets of the JavaScript Ninja, Second Edition explains function expression →

Also covered in

What to know first

Related concepts

Questions about function expression

What is function expression?

A function expression is an expression that creates a function value, which can be assigned, passed, or used within another expression.

Which Manning books explain function expression?

Secrets of the JavaScript Ninja, Third Edition and Secrets of the JavaScript Ninja, Second Edition.

What should I know before learning function expression?

Manning books that teach function expression usually introduce function, arrow function, object and scope first.

What is the difference between function expression and function declaration?

A function expression is an expression that creates a function value, which can be assigned, passed, or used within another expression. A function declaration is a source-language construct that introduces a function by specifying its name and parameter interface, and may also provide its implementation.

What kinds of function expression are there?

Kinds of function expression include immediately invoked function expression and named function expression.

What is function expression a kind of?

Function expression is a kind of function. A function is a callable unit of program code that performs a computation or operation, can accept inputs, and may produce a result or side effect.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.