Can someone explain what the document.getElementById(\"demo\") line does in the example below?
document.getElementById(\"demo\")
I understand getElementById gets the id of demo but the id is
Consider
var x = document.getElementById("age");
Here x is the element with id="age".
x
id="age"
Now look at the following line
var age = document.getElementById("age").value;
this means you are getting the value of the element which has id="age"