WSH一行野郎シリーズ。文字列の頭に文字を足して指定桁数にする

function fillLeft( str, n, ch ) { return ( (new Array(n+1)).join(ch || "0") + str ).slice(-1*n);}
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account log in.