Javascript String fit(l)

Description

Javascript String fit(l)


String.prototype.fit = function(l) {
 if (this.length <= l) {
  return this + '';
 } else {/*  w w  w .  j ava  2 s  . co  m*/
  return this.substr(0, l - 23) + '...' + this.substr(this.length - 20, 20);
 }
};



PreviousNext

Related