Usually, when working with functions with JavaScript, the parameters that you pass into the function would be fixed in numbers. function updateUser(name, age) { console.log(name, age); } updateUser('Cherika', 5); Here, as you can tell, the updateUser function accepts two parameters, and these parameters are fixed.
But there may be a certain situation where you would need a variable number of parameters. For instance, when accepting postal addresses from the user, the street, city, and state might be fixed.
function saveAddress(street, city, state) { console.log(street, city, state); } saveAddress('123 Street', 'NYC', 'New York'); But let’s say you want to collect more information regarding the address (like address 1, zip code, and country) without allocating a parameter for each of these fields.