Got confused about the loop thing in js | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Got confused about the loop thing in js

Hey guys can anyone can explain, how loop works and what its uses ?? Tbh im kinda confuse about that tag ... And the " i " thing. im a loser btw thank you !!

1st Nov 2018, 7:29 AM
box
box - avatar
2 Respostas
+ 4
Loop lets you repeat some operations without writing them many times. Variable 'i' is often used as a counter. You must set it's starting value, condition that must be met for the loop to work, and by what value you will be increasing 'i'. Example: for (var i = 0; i < 10; i++) { //some operations } Starting value is 0, every time 'i' is smaller than 10, the loop will repeat and after all operations in loop 'i' will increase by 1.
1st Nov 2018, 7:41 AM
Aleksander Szczepura
Aleksander Szczepura - avatar
+ 1
Learning something new is always a tough thing to do, just review the chapter and it will sink in eventually, you're never a loser unless you choose to give in to the difficulties. I think you can do this!
1st Nov 2018, 7:49 AM
Ipang