How can I find out the length of a function's parameter list?

// How to find out length of a function's parameter list
const add = (x, y) => x + y
console.log(`The add() function takes ${add.length} arguments`)

Last updated

Was this helpful?