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">
<title>HTML Page</title>
<header id="headerItem"> Old Header </header>

<button>Click Here</button> 

<script type="text/javascript">

function startLogic() {

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


('headerItem').innerHTML =

newHtml; }




I put it in a fiddle and it works fine:

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: