how to put loop in js html code code example
Example 1: how to make a javascript for loop
var tops = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144];
for (let i = 0; i < tops.length; i++) {
document.write(tops[i] + "tops");
}
Example 2: looping in javascript
for (initialization; test condition; iteration statement) {
Statement(s) to be executed if test condition is true
}