How would you create a new h1 element with JavaScript?

To create an h1 element with JavaScript do this: document.createElement("h1").

How to add it to HTML?

To add the created h1 element to the page with Hello World! text do this:

const h1Element = document.createElement("h1");
h1Element.textContent = "Hello World!";
document.body.append(h1Element);