I encountered an error that I initially thought was related to node.js, but now I'm not entirely sure. How can I go about resolving this issue?
[Running] node "c:\Users\Lenovo\Desktop\projectjs\index.js"
c:\Users\Lenovo\Desktop\projectjs\index.js:1
var counter = document.getElementById("count-el")
^
ReferenceError: document is not defined
at Object.<anonymous> (c:\Users\Lenovo\Desktop\projectjs\index.js:1:15)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
at internal/main/run_main_module.js:17:47
var counter = document.getElementById("count-el")
var count = 0
function increment() {
count = count + 1
counter.innerText = count
}
<body>
<div>
<h1>People entered:</h1>
<h2 id="count-el">0</h2>
<button id="increment-btn" onclick="increment">INCREMENT</button>
</div>
<script src="index.js"></script>
</body>