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); }
4 Respuestas
+ 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).
+ 1
Thanks a lot . I am new here i never seen += operator
+ 1
No problem,
We all started knowing nothing 👌
0
👏👍