So I'm running JSLint on the lastest version of jQuery available at bit.ly/jqsource. I've made the tests as lax as possible, but I still get errors. One of them is "Use a named parameter" on line 327:
target = arguments[0] || {},
What does it mean? Even this blog post doens't provide information.
It means that the code is accessing the parameter using the arguments
collection instead of a parameter specified in the function signature:
You can reproduce the error message with this code:
function x(a) {
var b = arguments[0];
}
Using the named parameter gives the same result without the lint error:
function x(a) {
var b = a;
}
I'll assume it actually says "Use a named parameter" instead of "variable".
If so, there can be a performance hit in some browsers when you reference the arguments
object. I'd guess that's what it's complaining about.
Some browsers will optimize away the creation of the arguments
object if it is never referenced.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With