Javascript Array toList(separator, aggregator)

Description

Javascript Array toList(separator, aggregator)


Array.prototype.toList = function(separator, aggregator) {
  aggregator = aggregator || separator;//from   w  w  w.ja  v a 2s  . c  o  m
  return this.join(aggregator, [this.join(separator, this.slice(0, -1)), this.slice(-1)]);
};



PreviousNext

Related