I want to pass an optional data parameter to some callbacks, but only to callbacks that support a single parameter; right now, I have a moderately-sized code base of callbacks that cannot accept a parameter at all. How can I check what parameters a Function
object supports?
Function is an Object. Every function has a read-only property named length that stores the number of parameters defined for the function. Use it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With