Q:

js reverse while loop

i'm trying to make do...while loop with reversed order and with "random step".
var estam = 100;
do
{

   //   some things, that can change variable "rd"

   estam -= Math.floor((Math.random()*rd)+1)
}
while (estam < 1);

But browsers just perform do once. 
I'm trying to get: "do something with some things and decrease variable estam accordingly to those things (and those some operations) as long as estam is bigger than zero".
Or i need to make ordinary loop with steps, and in each step check estam than jump out to function and back ?

A:

The do while expression should be read as "do this work while this expression is true".
You are looking for 
while (estam > 0);

which will ensure the loop breaks once estam is less than 0, when the expression is no longer true.

