I see that in PHP there are functions that can accept multiple options into a single argument, for example:
error_reporting(E_ERROR & E_WARNING);
I want to implement this kind of functionality into my javascript function. Do you know examples of functions that take this kind of arguments?
I’m totally confused about how does the function know what are the options that are passed…
Yes, it’s possible, but it works with
|.You could of course create a helper function which does the chekcing so that you don’t need those parentheses:
http://jsfiddle.net/pimvdb/NpFYj/1/