Is there a "code less" way to construct this JS loop? I just know there's a simpler, better way to do this. Will eventually append &lt;select&gt; options with these values (e.g. 01:30, 02:45, 10:15, etc.)

var arrHours=[]
var i=0, j=0, k=0;
for (i=0;i&lt;=23;i++)
{
    for(j=0;j&lt;=45;j=j+15)
    {
        var m,n;
        m=i.toString();
        n=j.toString();
        if(m=="0")
        {
            m="00";
        }
        if(m.length&lt;2)
        {
            m="0"+m;
        }
        if(n=="0")
        {
            n="00";
        }
        arrHours.push(m+":"+n);
    }
}
for(k in arrHours)
{
    $("#preview4").append(arrHours[k]+"&lt;BR&gt;");
}


ps. I prefer the semicolon. ;)
I would do it like this. Note how the zero-padding is encapsulated in a function and how the double loops are turned into a single loop by using modulo and integer division. Also, the vars are pre-declared as is considered good style in JavaScript.

function zeroPad(number) {
    if (number &lt;= 9) {
        return "0" + number;
    } else {
        return number;
    }
}

var i, hour, minute,
    arrHours = [];
for (i = 0; i &lt; 60 * 24; i += 15) {
    hour = Math.floor(i / 60);
    minute = i % 60;
    arrHours.push(zeroPad(hour) + ":" + zeroPad(minute));
}