javascript unshift arguments returns unexpected results

router.route = function (alias, pattern, action, constraints) {
   if (2 === arguments.length)
     Array.prototype.unshift.call(arguments, undefined)

   console.log(arguments)
}

router.route('/artist/:id', function () {})


{ '0': undefined,
  '1': '/artist/:id',
  '2': [Function],
  '3': undefined,
  '4': undefined,
  '5': undefined,
  '6': undefined,
  '7': undefined,
  '8': undefined,
  '9': undefined,
  '10': undefined,
  '11': undefined,
  '12': undefined,
  '13': undefined,
  '14': undefined,
  '15': undefined,
  '16': undefined,
  '17': undefined,
  '18': undefined,
  '19': undefined }

what i'm basically trying to do, is to make the "alias" argument optional but i'm trying to find a way of doing so without doing this.

if (2 === arguments.length) {
  action = pattern
  pattern = alias
  alias = undefined
}

so the unshift() basically works i get the same result. alias = undefined pattern = '/artist/:id' action = function () {}

but the problem is that out of nowhere i have 17 "undefined's" added to the end of the arguments array.

will this affect performance, and does anybody knows why that happened ?

edit

i accidentally wrote Array.prototype.unshift(arguments, undefined) instead of Array.prototype.unshift.call(arguments, undefined) in my original question, very sorry.

If those undefined places are there because of a resource timing out then yes, the performance will be affected. If it is just an empty array index then No it will not affect performance.

If I understand correctly, don't you just want to remove the first element of the array?

If so you can just do:

var args = Array.prototype.shift.call(arguments);