我正在尝试在控制台中记录值的更改(Firefox / Firefly,mac).
if(count < 1000) { count = count+1; console.log(count); setTimeout("startProgress",1000); }
这只返回值1.它在此之后停止.
我做错了什么还是有其他影响这个的?
解决方法
你没有循环.只有条件声明.使用时.
var count = 1; while( count < 1000 ) { count = count+1; console.log(count); setTimeout("startProgress",1000); // you really want to do this 1000 times? }
更好:
var count = 1; setTimeout(startProgress,1000); // I'm guessing this is where you want this while( count < 1000 ) { console.log( count++ ); }