how to change tag name in js html

JavaScript
 var p = document.getElementsByTagName("P")[0];

document.renameNode(p, null, "h1");

Source

Also in JavaScript: