I am not able to view the myvariable on the html page

Hi. when i try t4o voew one of my variables in a html page, i see nothing. If I open the console, I see this error - Uncaught TypeError: Cannot set property ‘innerHTML’ of null at my-java-script.js:17.

My script is the same as shown in the course. Here are the codes:
var c = 3+4;
console.log(“The value of c is”, c);
var x=6 ;
var y=3;
var s = x-y ;
console.log(“Subtraction of” , x , “and” , y , “is”, s);
var m = x*y ;
console.log(“Multiplication of”, x , “and” , y , “is”, m);
var a = x+y ;
console.log(“Addition of”, x , “and” , y , “is”, a);
var d = x/y ;
console.log(“Division of”, x , “and” , y , “is”, d);

var ao = (x*y +10)/4;
var myVariable = “HELLO”;
document.getElementById(“demo”).innerHTML = myVariable;


Java Webpage

Java script

<p id="demo"></p>

Here is a pic of the console and the webpage:

Hello! my problem is also related to this. I didn’t get any variable output in my html page. If I open the console, the error is like this:-
The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol. [my-html.html](file:///C:/Users/Prasanna/Desktop/BoltIot/my-html.html)

Here is the picture of web page:

make a JS file which all your JS statements in it and save it in the extension of .js
To access the JS file in your HTML document to need to add inside the .
or else write your JS code with in the tag eg:


    <title>Javascript Variables</title>
    <script type="text/javascript" src="my-javascript.js"></script>

Make a separate file with .js extention…and write all the arithmetic operations …code and place that file in . html extention

Thanks guys for your help but i figured the right way out. the line- has to be in the body tag. earlier as it was in the head tag, it was not being executed.
This works:

<title>Java Webpage </title>

Java script


You need to created a separate file for javascript file. While saving the file extension should be .js not html. Then you need to create another file with extension .html to access the .js file.
In HTML file inside the head tag you need to enter script tag.ex