As other answers show, if vs while is your problem. However, the best approach to this would be to use setInterval() , for example:
setinterval(startProcess, 1000);
This does not stop at 1000 calls, but I assume that you are just doing this for testing at the moment. If you need to stop doing this, you can use clearInterval() , for example:
var interval = setinterval(startProcess, 1000);
Nick craver
source share