Could somebody help,JavaScript code is not executing ?

This is an HTML 5 code,and I am using visual studio code . Though ,HTML part is giving output but there is no change in header after applying JavaScript code to it. I don’t seem to understand the problem. Pls help.

<!DOCTYPE html>
<html lang="en-US">
<head>
<title>HTML Page</title>
</head>
<body>
<header id="headerItem"> Old Header </header>

<section> 
<button>Click Here</button> 
</section>

<script type="text/javascript">

function startLogic() {

var newHtml =
'<em>New Header</em>';

document.getElementById

('headerItem').innerHTML =

newHtml; }

startLogic();

</script>

</body>
</html>

I put it in a fiddle and it works fine: https://jsfiddle.net/bvz8p4md/

P.S. When pasting code into a post, be sure to format it correctly so that it comes through using either the formatting toolbar (</>), indenting with 4 spaces, or surrounding it with 3 backticks (`).

Thanks senocular .
I realised later today that, though the code I posted in my question was correct but while writing the code in the file, I wrote ‘header’ instead of ‘headerItem’ and hence ,the reason of non execution of program.

That happens to the best of us :wink:

It also happens to the worst of us :run_in_fear: