What are the differences between arguments object and rest parameter

Posted by Jennifer | Updated on

There are three main differences between arguments object and rest parameters

  1. The arguments object is an array-like but not an array. Whereas the rest parameters are array instances.
  2. The arguments object does not support methods such as sort, map, forEach, or pop. Whereas these methods can be used in rest parameters.
  3. The rest parameters are only the ones that haven’t been given a separate name, while the arguments object contains all arguments passed to the function

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers