Language syntax

Object rest binding

Try the free JavaScript compiler

Copies enumerable own string and symbol keys not selected by preceding properties. Must be last; a rest binding in an object binding pattern names an identifier. Source remains unchanged unless other effects occur.

Formal Syntax & Structure

javascript syntaxjavascript
const {selected, ...rest} = source;

Working Example

Example Snippetjavascript
const {id,...data}={id:1,x:2}; console.log(Object.keys(data).join(","));
JavaScript Reference