Rest operator
In JavaScript, rest syntax uses three dots to collect remaining function arguments, array elements, or object properties into a single binding.
Essential TypeScript 5, Third Edition
A rest parameter collects an arbitrary number of function arguments into a single parameter value.
- How it is used
- Allows functions to accept extra arguments without declaring a separate parameter for each one.
- How deep it goes
- Explains syntax, last-position and single-parameter rules, array initialization, typed values, and calls with varying argument counts.
- Examples
- Works through price summation with mixed JavaScript values and a TypeScript tax calculation with zero or several extra fees.
- What you can do after
- Build it from scratch: define a TypeScript function that collects and totals a variable number of typed extra arguments.
Read how Essential TypeScript 5, Third Edition explains rest operator →
Secrets of the JavaScript Ninja, Second Edition
A function parameter syntax that collects remaining supplied arguments into a single array-like value.
- How it is used
- Collects excess function-call arguments under one named parameter so a function can process a variable number of values.
- How deep it goes
- Explains the syntax, array collection, and final-parameter restriction, and demonstrates sorting without detailing browser compatibility.
- Examples
- Demonstrates `multiMax(3, 1, 2, 3)`, sorting the remaining values, and multiplying the first by the largest.
- What you can do after
- Apply `...name` to collect remaining arguments into an array and process them inside a function.
Read how Secrets of the JavaScript Ninja, Second Edition explains rest operator →
Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond
A function parameter in JavaScript syntax that collects the remaining arguments into a single array binding and must appear last in the parameter list.
- How it is used
- Collects variable numbers of function arguments for array processing or forwarding through a wrapper.
- How deep it goes
- Explains the syntax, array binding, last-position rule, and forwarding pattern through short worked examples.
- Examples
- Uses family and property-selection functions, an image-processing wrapper, and a CSS-class exercise.
- What you can do after
- Apply it via JavaScript rest parameters to collect extra arguments and pass them through a logging wrapper.
Related concepts
- argumentsalternative to · The JavaScript arguments object is an array-like object available inside non-arrow functions that exposes the values passed to the current function invocation.
- arrayproduces · An array is an indexed, ordered collection of elements arranged in one or more dimensions, with elements accessed by position.
- functionpart of · A function is a callable program unit that performs an operation, may accept inputs, and can produce a result or side effect.
- spread operatorcontrasts with · A spread operator is syntax that unpacks a collection’s elements or an object’s properties into individual values within an expression or function call.
- function argumentuses · A function argument is a value or expression supplied when a function or method is invoked, providing input to the called operation.
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.


