![]() ![]() Why 0? Because arrays are zero-indexed in JavaScript, which means the first value in the array is found at position 0, not 1. It’s supposed to stand for “integer” since that’s what you’re incrementing. In 99% of cases, the starting point will look like `i = 0`. ![]() There are three statements you pass in to a for-loop: the starting point, the end point (exit condition), and the rate at which the loop is going from the start to the end point. For a for-loop, that condition is having to run a specific number of times (unless the code itself is designed to exit the loop prematurely). Repeat a certain amount of code until a condition is met. The basic for-loop’s structure is simple. If you’re already familiar, feel free to skip ahead. You’ve got more options for looping than you’ll probably want to know about. Looping is one of the first things you learn as a programmer. ![]()
0 Comments
Leave a Reply. |