Javascript Array toString(delim)

Description

Javascript Array toString(delim)

// convert an array to a string with the given delimiter
Array.prototype.toString = function (delim) {
    var ret = "";
    var i;/*from  w w w  .ja v a  2 s .co  m*/
    for (i = 0; i < this.length; i++) {
        if (i > 0) {
            ret = ret.concat(delim);
        }
        ret = ret.concat(this[i]);
    }
    return ret;
}



PreviousNext

Related