I have a simple question regarding while loop in Javascript. When I run this simple loop in browser console:
var count = 0;
while (count < 10) {
console.log(count);
count++;
}
The output to console log is 0,1,2...9. (as expected). However there is one more number which is returned to the console:
<- 9
Where does this return value come from?
I assume this is the return value of count++ expression
. But why is the value not returned by every single loop?
Is it possible to somehow catch that returned value to a variable?