for loop I - creating JavaScript loops

Let's start with our first for-loop. A for-loop is a JavaScript statement that is executed over and over again as long as a certain condition is met. The typical syntax is for (initialization; condition; increment) { statement }. The initialization is typically used to declare a counter variable. It is evaluated only once before the first round of the loop. The condition is an expression that evaluates to true or false. If it evaluates to false the loop will stop. Increment is used to update the counter variable after each loop iteration.
In the example below we have a for-loop where we create a counter-variable i with the value 1. As long as i is smaller than 3 the loop keeps running. After each iteration i is incremented by 1. In each iteration we log the current value of i. We also add the value of i to the variable result.
Task: Adjust the code such that the console.log() logs true.
Tipp: Be careful not to implement an infinite loop! This happens when the condition of the loop always evaluates to true.
Get a premium membership to access this content: