陷入无限循环。我在这里错过了什么?

时间:2017-06-12 18:53:28

标签: javascript for-loop

所以我有这个循环,我被困在第二个,但如果我,我也会被困在第一个,这里的问题是什么?

for(var i = 0; i < oldtds.length;i += 3)
{
    var oldNameIndex = sameName(oldtds[i].innerHTML, nameList);
    if(oldNameIndex != -1)
    {
        //This means the name already exists
        //I need to combine the times, and remove the tr from the table for the second name
        //this loop accesses all the times
        for(var j = i + 1; j < oldtds.length; j += 3)
        {
            //This won't quite work, There are colons between them
            var timerArray = oldtds[j].innerHTML.split(":");
            timerArray.push(oldtds[oldNameIndex + 1].innerHTML.split(":"));
            console.log(timerArray);
            console.log("this is j " + j);
        } 
    }
}

0 个答案:

没有答案