<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Variables</h1>
<p>In this example, Sex is defined as a variable.
Then, Sex is assigned the value of 0:</p>
<p id=”demo”></p>
<script>
var sex;
sex = 0;
document.getElementById(“demo”).innerHTML = x;
</script>
</body>
</html>
Output:
JavaScript Variables
In this example, Sex is defined as a variable. Then, Sex is assigned the value of 0:
<!DOCTYPE html>
<html>
<body>
<h1>Assigning Values</h1>
<p>In JavaScript the = we are assigning values to variables.</p>
<p id=”demo”></p>
<script>
var diseaseNo = 0;
var diseaseYes = 1;
document.getElementById(“demo”).innerHTML = diseaseNo + diseaseYes;
</script>
</body>
</html>
Output:
Assigning Values
In JavaScript the = we are assigning values to variables.
1