Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- setInterval loop


sssweb - 8:04 pm on Dec 24, 2011 (gmt 0)


I must be missing something simple, but can someone explain why the following occurs in a function running on setInterval:

var num = 10;

function my() {
if (num2){
// script never gets here
}
else {
num--;
if (num<1) {
var num2 = 1;
}
}
}

I've verified that it initializes num2, but it never goes in the first conditional.


Thread source:: http://www.webmasterworld.com/javascript/4401233.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com