JS Coding Questions Logo
JS Coding Questions
#187💼 Interview💻 Code

What happens if you do not use rest parameter as a last argument

Advertisement

728x90

The rest parameter should be the last argument, as its job is to collect all the remaining arguments into an array. For example, if you define a function like below it doesn’t make any sense and will throw an error.

javascript
1function someFunc(a,…b,c){
2  //You code goes here
3
4return;
5}

Advertisement

Responsive Ad
🎯 Practice NowRelated Challenge

JavaScript Coding Exercise 16

Test your knowledge with this interactive coding challenge.

Start Coding

Advertisement

728x90
187of476
What happens if you do not use rest parameter as a last argument | JSCodingQuestions.com