Question about Javascript tutorial, don't understand 'main.js'

Question about Javascript tutorial, don't understand 'main.js'

In the given JQuery tutorial, therefor my thanks, I was directed to the principles of Javacript, also not well understood (please see here for my question)
I try to excecute the example (you must first download it etc.), Hello World, but without succes.

Now add the following code to the main.js file : (html ext.!)     
var myHeading = document.querySelector('h1');
myHeading.innerHTML = 'Hello world!';

Problem: I made a folder/html: name main.js, and pasted this
between <body></body>. No result. Nothing happens also on adding <> tags beginning/end.
I use 'Kompozer' as a HTML editor, should not be of a problem.
What am I doing wrong?

My editor has changed the text in the following way:
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title>main.js</title>
</head>
<body>
<br>
<var myheading="document.querySelector('h1');"
myheading.innerhtml="Hello world!">
</var> <br>
</body>
</html>

See for yourself: again what is wrong?