Javascript String pad(length)

Description

Javascript String pad(length)

String.prototype.pad = function(length) {
 var str = this;/*from  w  w w .ja  v a  2s . c  o  m*/
 while (str.length < length) {
  str = '0' + str;
 }
 return str;
};



PreviousNext

Related