본문 바로가기

program study

[자바스크립트] 10보다 작으면 0붙임

//10보다 작으면 앞에 0을 붙임
function addzero(n) {
 return n < 10 ? "0" + n : n;
}