public static Object[] padArguments(Object[] args,int count){
  if (count < args.length)   return args;
  int i;
  Object[] result=new Object[count];
  for (i=0; i < args.length; i++) {
    result[i]=args[i];
  }
  for (; i < count; i++) {
    result[i]=Undefined.instance;
  }
  return result;
}

public static Object [ ] padArguments ( Object [ ] args , int count ) { if ( count < args . length ) return args ; int i ; Object [ ] result = new Object [ count ] ; for ( i = 0 ; i < args . length ; i ++ ) { result [ i ] = args [ i ] ; } for ( ; i < count ; i ++ ) { result [ i ] = Undefined . instance ; } return result ; }
helper function for builtin objects that use the varargs form . ecma function formal arguments are undefined if not supplied ; this function pads the argument array out to the expected length , if necessary .
