JavaScript loops | Sololearn: Learn to code for FREE!

0

JavaScript loops

Plz any one explain me by example that using loops can helps really make easy . And the use of loops in many real life projects.

5/3/2021 5:57:25 PM

Aurosish Rout

3 Answers

New Answer

+6

Loop is very useful and you'll understand them only if you keep using them. There's a For loop For in loop For of loop For each loop While loop All they do is to iterate through some sequence based on a define condition. A real world use while loop is to calculate the factorial of a number N let N = 5; let res = 1; let counter = N; while (counter) { res *= counter; counter--; } ; console.log(res)

+5

In programming not only javascript, loops are used to repeat a block of code. https://code.sololearn.com/Wm73RnTlWlly/?ref=app

+1

Thanks everyone for answering .