Javascript Number pad(len)

Description

Javascript Number pad(len)


Number.prototype.pad = function(len) {
  s = num.toString();/*from   w ww  .j a  v a  2 s.c om*/
  if (s.length < len) {
    s = ('00000000000000000000' + s).slice(-len);
  }
  return s;
};



PreviousNext

Related