function myFunc(event, target, banned, handler){}
myFunc(event, handler);
//Или
myFunc(event, target, handler);
//Или
myFunc(event, target, banned, handler);
function foo(params) {
if (params.hasOwnProperty(prop)) {
// ...
}
}
foo({
prop: value,
prop_1: value,
prop_3: value,
prop_2: value
});
function myFunc(event, target, banned, handler){
var arglen = arguments.length;
var handler = arglen > 1 ? arguments[arglen-1] : undefined;
var banned = arglen > 3 ? arguments[2] : undefined;
var target = arglen > 2 ? arguments[1] : undefined;
console.log({
event:event,
target:target,
banned:banned,
handler:handler
});
}
myFunc('event', 'handler');
myFunc('event', 'target', 'handler');
myFunc('event', 'target', 'banned', 'handler');
arg= $.extend({}, default_arg, arguments);