JS offers the 'arguments' object inside of functions to represent all passed arguments. Is there any broadly accepted concept for when/where this should be used?I've seen items like this in the 'wild' that seem like code smell to me:function myFxn () {  var myVar = arguments[0];  // do something with myVar}this is a very simplified example, but it illustrates what seems to me to be a poor coding practice. I would preferfunction myFxn (myVar) {  // do something with myVar}A colleague used it in a number of places where they only wanted to name the 'required' args ('required' by the implemenation ) but omit the 'optional' ones:function myFxn (myReqVar) {  var myOptVar = (arguments[1] !== undefined) ? arguments[1] : false;  // do something with vars}This didn't seem wise on grounds of reduced readability and maintainability. It seems to me to create functions with confusing interfaces that must rely on the developer's knowledge of its intent or external documentation to understand and use.Is this just a matter of opinion, or is there a preponderance of opinion on this?
What is the normative (best) use of Javascript arguments object
javascript;code quality
I think you are right, the best practice would be to use parameters over var paramName = arguments[0] .  It is cleaner, easier to read and it shows the intent better.   As a general rule of thumb the arguments object should be used over params under a few scenarios:There can be N number of params:    function sum(){    var total = 0;    for (var i = 0; i < arguments.length; i++) {        total += arguments[i];    }    return total;}If you want to generically call other functions with the passed in arguments:function other() {    otherFunction.apply(this, arguments);}vsfunction other(arg1, arg2, arg3) {    otherFunction.call(this, arg1, arg2, arg3);}Using reusable functions that use arguments:Here is an example of a generic argument validating :https://codereview.stackexchange.com/questions/31593/throwing-error-if-settings-arguments-are-undefined-is-this-a-good-breakout-fun/31602#31602