I have, in multiple parts of my code, snippits similar to this:
function updateScore() {
var currentPoints=0;
for (nni=0;nni<currentSession.Questions.length+1;nni++) {
currentPoints+=currentSession.Questions[nni].Score;
}
alert('hi');
document.getElementById('quiz_score').innerHTML='%'+(currentPoints/currentSession.TotalPoints)*100
}
Everything works fine... until after the loop. This happens in multiple cases. The alert won't even show after the loop ends. It's like the function just stops...
I'm also having problems where the iterator (in this case, nni) stays global. Basically, I can't use that variable ever again in my code because for some reason, if I change nni, it messes up the for loop. I'm obvisouly not doing something right. I'm a self tought Javascripter (basically googling anything I don't know, I've never taken a lesson). I must be missing something about for loops.
Thanks if you can!
+1innni<currentSession.Questions.length+1? Won't that run over the end of the loop? Maybe that's causing an exception; check the JS console.