I saw this question: Multiple arguments vs. options object and the consensus seemed to be the object argument list was a good design pattern for long argument lists or lists including optional args.
I was wondering what the advantages/disadvantages of using it for functions with only 2 or 3 argument were, i.e., why would you ever use a traditional argument list?
function normalArgs(arg1, arg2, arg3) {
// order of args in function call must be correct
}
function objectArgs(args) {
// use args.arg1, args.arg2, args.arg3
// significantly reduces errors involving out of order/missing arguments
}
Is the creation of the object literal significant overhead or something?