Potentially out of bounds arguments should not just be directly accessed, instead use a ternary operator to check length.
5 lines
163 B
JavaScript
5 lines
163 B
JavaScript
function foo() {
|
|
var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "foo";
|
|
var b = arguments.length > 1 ? arguments[1] : undefined;
|
|
}
|