+ 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 Antworten
+ 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.