code: @Override
      public String getArrayFunction(String function, Object[] ary) {
          if (ary == null || ary.length == 0) {
              return function + "([]);";
          }
          StringBuilder sb = new StringBuilder();
          sb.append(function).append("([");
          for (Object arg : ary) {
              if (arg instanceof JavascriptObject) {
                  sb.append(((JavascriptObject) arg).getVariableName()).append(",");
              } else {
                  sb.append(getArgString(arg)).append(",");
              }
          }
          sb.replace(sb.length() - 1, sb.length(), "]").append(")");
  
          return sb.toString();
      }
docs: Gets an array function as a String, which then can be passed to the
  execute() method.
  
  @param function The function to invoke
  @param ary The array of arguments to pass to the function.
  @return A string which can be passed to the JavaScript environment to
  invoke the function