-
I'm very new to JQuery so apologies if this is a silly question, but I want to be able to overload a function in the terminal so that I can have a command that can take either one argument or no arguments. Here's my code: When I test this in the terminal, I get:
Clearly I'm doing something wrong, but I'm not sure what. Is it possible for a function to take multiple arguments in the JQuery terminal? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This has nothing to do with jQuery. JavaScript doesn't support of overloading. Only statically typed languages have this feature. If you want a variable number of arguments, you create a single function. If the command does not have that argument, it will be undefined. But for it to work, you need option |
Beta Was this translation helpful? Give feedback.
This has nothing to do with jQuery. JavaScript doesn't support of overloading. Only statically typed languages have this feature.
If you want a variable number of arguments, you create a single function. If the command does not have that argument, it will be undefined. But for it to work, you need option
checkArity: false