I get an infinite loop because of this small bit of code. It becomes fixed if I declared the var i to any value (i.e. var i = 0) before the loop, and I'm not sure why. Could someone who's familiar with javascript's intricacies explain to me what's going on here?
for (num = 1; num <= 2; num++) {
for (i = 1; i < num; i++) {
console.log("hi");
}
}
ideclared somewhere else and modified in the actual body of your loop?