+ 1

Write a javascript code to display even number from 2-20 using while loop

19th Nov 2019, 2:18 PM
Akash Paul
Akash Paul - avatar
10 Respostas
+ 2
something like : for(var i =2 ; i <= 20; i++) { if ( i % 2 ==0){ console.log(i); { {
19th Nov 2019, 2:24 PM
Bahhaⵣ
Bahhaⵣ - avatar
+ 2
that is for a for loop. use the same logic to create it with while loop.
19th Nov 2019, 2:29 PM
Bahhaⵣ
Bahhaⵣ - avatar
+ 1
hint : write it using a loop and an if condition with the modulus %.
19th Nov 2019, 2:20 PM
Bahhaⵣ
Bahhaⵣ - avatar
+ 1
Tq
19th Nov 2019, 2:20 PM
Akash Paul
Akash Paul - avatar
+ 1
Do u know the codding of this
19th Nov 2019, 2:21 PM
Akash Paul
Akash Paul - avatar
+ 1
Tqsm
19th Nov 2019, 2:25 PM
Akash Paul
Akash Paul - avatar
+ 1
for(let i = 2; i <=20; i +=2){ console.log(i); }
19th Nov 2019, 8:44 PM
Wstoo
Wstoo - avatar
+ 1
The JS tutorial you started a month ago should help with while loops 😉
21st Nov 2019, 1:04 PM
Sonic
Sonic - avatar