0

i dont understant

Fill in the blanks to print EVEN values from 0 to 20 using a for loop: var x = 0; for (; x <= ; x += ) { document.write(x); }

7th Apr 2021, 7:56 AM
Selim Isabetli
Selim Isabetli - avatar
4 ответов
+ 3
for( ; x <= 20; x += 2 ) Explanation: The loop begins with <x> being zero (an even number), it goes around while <x> is less than or equal to 20 (also an even number). The loop increments <x> by two in each iteration to be sure that the value of incremented <x> will always be an even number. Note: += operator works by adding the right hand operand (2) to the current value of the left hand operand (x).
7th Apr 2021, 8:03 AM
Ipang
+ 1
Thanks a lot . I am new here i never seen += operator
7th Apr 2021, 8:09 AM
Selim Isabetli
Selim Isabetli - avatar
+ 1
No problem, We all started knowing nothing 👌
7th Apr 2021, 8:11 AM
Ipang
0
👏👍
7th Apr 2021, 8:15 AM
Selim Isabetli
Selim Isabetli - avatar