Rest Parameter
A final function parameter beginning with ... that collects remaining arguments into an array.
What is Rest Parameter in JavaScript?
Rest Parameter — A final function parameter beginning with ... that collects remaining arguments into an array.
function total(...prices) {
return prices.reduce((sum, price) => sum + price, 0);
}
Level: Apprentice · More JavaScript terms at this level
Updated