Do you ever see the alert() from the JS file ?
Does the following line run when you load your the HTML file in your browser?
window.alert("hi how are you" + w)
I'm guessing that it does not.
If it doesn't then the HTML file may not be located in the same folder where the JS file is located and so it cannot load the JS file because it cannot find it.
Are the two files in the same folder?
How about a JSBIN? Here's your code -- I fixed it and it runs:
JS Bin - Collaborative JavaScript Debugging[
^]
Main Problem
The main problem was that you were redefining the w variable and it was making all your js fail.
You had:
var w,a;
let w = 3;
That defines w with the old var keyword.
Then you attempted to redefine w again with teh new let keyword.
of course, a is not used anywhere anyways.
So just make it
let w = 3;
Take a look at the jsbin I created. it works.
Also, don't use getElementById()
Switch to using document.querySelector("#idname");
You see it in the jsbin.
Good luck.