Can't declare variables in JavaScript or use them in a mathematical equation
06:41 30 Nov 2025

I'm just starting JavaScript and I can't declare a variable. Possible that it is being declared but when I use the variables in a math equation there is no output from that equation.

For example:

JavaScript Variables

In this example, x, y, and z are variables.

let x = 5; let y = 6; let z = x + y; document.getElementById("demoVariables").innerHTML = "The value of z is " + z; //demoVariables is a paragraph block level element which is supposed to change to "The value of z is " and the value of z after that but for now is not being used or altered and I don't know why.

I load this .html file in the web browser but it doesn't show the output of the equation z = x + y or "The value of z is " it just shows the h1 and p elements

javascript