Javascript String truncate(length)

Description

Javascript String truncate(length)

String.prototype.truncate = function(length) {
  return this.substr(0, length - 1) + (this.length > length? '...' : '');
}



PreviousNext

Related