¿alguien podría explicarme como funcionan estas líneas de código ?. | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 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));

8th Oct 2020, 2:58 PM
Nicolas Lopez
Nicolas Lopez - avatar
3 ответов
+ 1
😣
8th Oct 2020, 2:58 PM
Nicolas Lopez
Nicolas Lopez - avatar
+ 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.
8th Oct 2020, 4:48 PM
Paul
Paul - avatar
0
Thank you very much.
9th Oct 2020, 11:54 AM
Nicolas Lopez
Nicolas Lopez - avatar