Creating a header from a prompt

How can i use a value entered through a prompt and put it inside an h1 element when i press a button


<button onclick="myFunction()">Try it</button>

function myFunction() {
  var h = document.createElement("h1")    
  var t=prompt("Pick a new title:");
  var p=document.createTextNode(t)
  h.appendChild = p;



This line is the problem:

h.appendChild = p;

That’s not how the .appendChild method works, see here: