<!DOCTYPE html>Click the button to loop from 1 to 6, to make HTML headings.onclick="myFunction()"Try itid="demo"function myFunction(){var x="",i;for (i=1; i<=6; i++){x=x + "<h" + i + ">Heading " + i + "</h" + i + ">";}document.getElementById("demo").innerHTML=x;}