looping in using javascript it's useful when you wand to a program The same task again and again without writing the same code Repeatedly
-
Different types of loops in javascript
- For loop
- While loop
- Do while loop
- For of loop
- For in loop
This are the looping types
- Yesterday i learn start with ( while looping ). A while looping in Javascript is used to repeat of block a code in long as condition is True It is called an entry-controlled loop because the condition is checked before the code runs.

output:
0
1
2
3
4
(first start with i = 0)
(check condition i < 5)
(it's true run the code)
(increase i++)
(the repeat until condition becomes false)
Initialize - i = 0
Check condition - i < 5
Print - 0
Increment - i = 1
Check - i < 5
Print - 1
Increment - i = 2
Check - i < 5
Print - 2
Increment - i = 3
Check - i < 5
Print - 3
Increment - i = 4
Check - i < 5
Print - 4
Increment - i = 5
Check - i < 5 false Loop stops
Important point is if you don't update variable it running forever That is called (infinite loop)

Top comments (0)