Thanks niche,
so I suppose is always fundamental to define a variable as a string or as a number (var number = 0 or var text="").
I still have to understand how the loop works and the importance of the variable 'text' for the code itself.
I tried to delete the '+' from the code, and use text = ... instead of: text += "The number is " + i + "<br>";
and the result is only the last line, 'The number is 4'.
So I do not understand what text = text + "The number is " + i + "<br>"; means inside the loop, if one should explain it in words.
Taken for granted that understand "