Let's do an example to clarify the things. We will revert to our favorite phrase, "Hello World!". Suppose we want to display this text 15 times on a web page. Doing this thing in plain HTML will require typing "Hello World!" 15 times. But then why is JavaScript for. We will take help from the write property of the document object (see one of the previous articles):
The copyright of the article
Loops and Strings Basics in
JavaScript is owned by Muhammad Ali Shah. Permission to republish
Loops and Strings Basics in print or online must be granted by the author in writing.