I have been messing with JavaScript tests, and I did try this code
var count = 0;
while(count < 100000000)
{
count++;
}
VS
var count = 0;
do
{
count++;
} while(count < 100000000);
and here are the results:
So I googled it , but did not find any good answer. Can any one explain to me why a while
is more efficient than do-while
?