With arguments.length I can see how many arguments were passed into a function.
But is there a way to determine how many arguments a function can take s
Beware, before counting on fn.length, there are some edge cases where the result may not be what you expect:
const fn1 = ( a, b ) => {}; // length: 2
const fn2 = ( a = 0, b ) => {}; // length: 0
const fn3 = ( ...params ) => {};// length: 0
const fn4 = ( a, b = 1, c ) => {};// length: 1
fn.length doesn't seem to recognize default values or rest operator.
You can mess with this codePen