+ 1
Âżalguien podrĂa explicarme como funcionan estas lĂneas de cĂłdigo ?.
Function test (number ) { Â Â While (number < 5) { Â Â number ++; } Return number; } alert(test (2));
3 Answers
+ 1
đŁ
+ 1
The function will return 5 if the tested number is 5 or smaller. Numbers bigger than 5 will return their original value.
The reason is the while loop. It increases small numbers until it is 5. For bigger numbers the while loop will not run.
0
Thank you very much.