Adding extra zeros in front of a number using jQuery?

后端 未结 14 1166
粉色の甜心
粉色の甜心 2020-11-30 02:45

I have file that are uploaded which are formatted like so

MR 1

MR 2

MR 100

MR 200

MR 300

14条回答
  •  迷失自我
    2020-11-30 03:22

    In simple terms we can written as follows,

    for(var i=1;i<=31;i++)
        i=(i<10) ? '0'+i : i;
    

    //Because most of the time we need this for day, month or amount matters.

提交回复
热议问题