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 !!
2 Respuestas
+ 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.
+ 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!