Skip to content

Latest commit

 

History

History
11 lines (8 loc) · 252 Bytes

rest-parameters.md

File metadata and controls

11 lines (8 loc) · 252 Bytes

Rest parameters

Store multiple arguments in an array. Useful when one is not sure beforehand how many arguments are needed.

function sendCars(...allCars){
    allCars.forEach(id => console.log(id))
}

sendCars(['monday',2,3,4,4])