javascript for loop new line when getting to the end of screen 1

javascript for loop new line when getting to the end of screen

for (i = 0; i <= 10; i++) {
    document.getElementById("my-paragraph").innerHTML = "Hello World\n";
}
  

Here is what the above code is Doing:
1. We create a variable called i and set it equal to 0.
2. We create a for loop that will run as long as i is less than or equal to 10.
3. We increment i by 1 each time the loop runs.
4. We print the string "Hello World" to the console.

Similar Posts