arrayobj.join(separator) 
将数组中的所有元素用separator连接起来,如
  a = new Array(0,1,2,3,4);
  b = a.join("-");
b应该为0-1-2-3-4。

解决方案 »

  1.   

    Description
    Converts all elements of an array into a String object and joins them.
    Syntax
    arrayobj.join(separator) The separator argument is a String object that is used to separate one element of an array from the next in the resulting String object. If omitted, the array elements are separated with an empty string.Res
    The join method returns a String object that contains each element converted to a string and concatenated together. 
    The following example illustrates the use of the join method: function JoinDemo()
    {
      var a, b;
      a = new Array(0,1,2,3,4);
      b = a.join("-");
      return(b);
    }--------------------------------------------------------------------------------
      

  2.   

    返回字符串值,其中包含了连接到一起的数组的所有元素,元素由指定的分隔符分隔开来。arrayObj.join(separator)
    参数
    arrayObj 
    必选项。Array 对象。 
    separator 
    必选项。是一个 String 对象,作为最终的 String 对象中对数组元素之间的分隔符。如果省略了这个参数,那么数组元素之间就用一个逗号来分隔。 
    说明
    如果数组中有元素没有定义或者为 null,将其作为空字符串处理。