Unlimited number of parameters in arrow function

PHOTO EMBED

Fri Sep 16 2022 13:32:35 GMT+0000 (Coordinated Universal Time)

Saved by @sreejithbs

// Let us access the arguments object
​
const sumAllNums = (...args) => {
 // console.log(arguments), arguments object not found in arrow function
 // instead we use a parameter followed by spread operator (...)
 console.log(args)
}

sumAllNums(1, 2, 3, 4)
// [1, 2, 3, 4]
content_copyCOPY

https://github.com/Asabeneh/30-Days-Of-JavaScript/blob/master/07_Day_Functions/07_day_functions.md