if you get the value of counterTwo as the return value of another function, in the first case you have to make sure that the if statement.
eg.
var counterTwo = something.length; while(counterTwo > 0) { counterTwo--; document.write(something.get(counterTwo)); }
or
var counterTwo = something.length; if(counterTwo < 0) return; do { counterTwo--; document.write(something.get(counterTwo)); } while(counterTwo > 0);
The first case is useful if you are processing data in an existing array. The second case is useful if you are "collecting" data:
do { a = getdata(); list.push(a); } while(a != "i'm the last item");
user287107
source share