For example, this won't trigger any warnings from JSHint, even though one of the arguments isn't used by the function, and isn't even part of the function signature.
function foo(x) { return x; }
foo(4, 5);
For example, this won't trigger any warnings from JSHint, even though one of the arguments isn't used by the function, and isn't even part of the function signature.
function foo(x) { return x; }
foo(4, 5);
No, it can't. The most likely reason for this is that a relatively common JavaScript pattern is to use the arguments
collection to allow the passing of an arbitrary number of arguments. For example:
function findHighestNumber() {
return Math.max.apply(Math, arguments);
}
findHighestNumber(1, 5, 19, 3); // 19
In this case, the function can accept any number of arguments and doesn't require any named parameters.