Javascript Number pad(n)

Description

Javascript Number pad(n)


// num/*  w  ww. j  av a2 s.c o  m*/

Number.prototype.pad = function (n) {
    var num = this;
    return Array(n - ('' + num).length + 1).join(0) + num;
}



PreviousNext

Related