I'm running this code:
var number = 0;
while (number <= 11) {
console.log(number);
number += 2;
}
But the output goes to 12. I've tried same with for
loop the output was okay, till 10.
It tried it another way by replacing console.log
with console.warn
in while
loop. The output warns till 10 but logs 12.
Further, by replacing console
with alert
, I got output till 10 in alert but still I see 12 in console.