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
Here in your code demo is id where you want to display your result after click event has occur and just nothing.
demo
You can take anything
<p id="demo">
or
<div id="demo">
It is just node in a document where you just want to display your result.