- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the difference between rest parameters and the arguments object in Javascript?
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
Advertisements