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.
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
Published on 25-Jan-2018 11:26:19