Rest parameters
With rest parameter, you can represent a number of arguments as an array. ES6 brought rest parameter to ease the work of developers. For arguments objects, rest parameters are indicated by three dots … and precedes a parameter.
Arguments object
Arguments object in JavaScript is an object, which represents the arguments to the function executing.
Here is the difference between rest parameters and the arguments object.
- Arguments object includes all arguments passed to the function, whereas rest parameters are those, which are not given another name.
- The rest parameters are Array instances, whereas arguments object isn’t an array. Array instances are the following methods: map, sort, pop, etc