function lpad(len,initstr,padstr) { var result=""; for(var i=1;i<=len-initstr.toString().length;i++) { result += padstr; } result += initstr; return result; }
去芜存菁
function lpad(len,initstr,padstr) { var result=""; for(var i=1;i<=len-initstr.toString().length;i++) { result += padstr; } result += initstr; return result; }