Say you have two functions with the following signatures:
addClass( class )addClass( class, duration )
These live in a third party library (no prizes for guessing which!!).
If you call addClass() with two parameters but only have signature 1 registered, there will be no error and signature 1 will be called. The second parameter is ignored.
So is there a way to detect that signature 2 with two parameters has been registered?
You can use the
lengthproperty of the function object to check the signature. Example: