Javascript String padLeft(size, char)

Description

Javascript String padLeft(size, char)


String.prototype.padLeft = function (size, char) {
    if (size === 0) {
        return '';
    }/*  www.ja v a  2s .  c o  m*/
    return (Array(size + 1).join(char) + this).slice(-size);
};



PreviousNext

Related