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.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners