This short article will cover and how to use them in JavaScript programming. I assume you have some familiarity with coding in the JavaScript ecosystem. Rest parameters The arguments object If you have some JavaScript experience, you might be familiar with the object. The object is an accessible object that contains the values of the parameters passed to a function. arguments arguments { .log( [ ]); .log( [ ]); .log( [ ]); } func1( , , ); ( ) function func1 a, b, c console arguments 0 // expected output: 1 console arguments 1 // expected output: 2 console arguments 2 // expected output: 3 1 2 3 However, there are limits with the object. The first is that it is not an array so you can’t perform things like with it. The second issue is there is no direct way to access a specific subset of the function parameters. arguments slice() Rest parameters If the object is not fit with your use case, you can use the new where you use it with the . It allows you to basically capture the rest of the parameters. What that means is your functions can accept an indefinite number of parameters as an array (not an object). arguments rest parameters …syntax In the code example below, we used the rest parameters' syntax for the second parameter. That means we can have a different variable for the first parameter, which is a capability not present with the object. arguments { ( i = ; i < args.length; i++) { .log(level + + args[i]); } } log( , , , , ); ( ) function log level, ...args for var 0 console ': ' 'INFO' 'Hello There' 6 'I have the high ground' 'It\'s a trap' // expected output: // INFO: Hello There // INFO: 6 // INFO: I have the high ground // INFO: It's a trap That is all. We learned about how we can use rest parameters as an alternative to the arguments object. Originally published at https://micogongob.com/rest-parameters-in-javascript .