let count = 10;
while(count--) {
//some code
}
console.log(count)let count = 10;
while(count) {
//some code
count--
}
console.log(count)
0--, и естественно 0 превращается в false, но после условия count уменьшается. Хотите уменьшать число прямо в условии - используйте предекремент:let count = 10;
while (--count) {}
console.log(count)