0
function, number++
Why is this returning 5? The following code will result in what value? function test(number) { while(number < 5) { number++; } return number; } alert(test(2)); Thank you!
1 Answer
+ 2
number=2;
while(number<5){
number++;
}
Loop iteration :
2<5//true number++
3<5//true number++
4<5//true number++
5<5//false exit the loop
Now number=5