'ReferenceError: document is not defined (JavaScript in VS Code)

Im learning JS. Found a good video "JavaScript Programming - Full Course" and stucked at the 2nd part where I need to use DOM. I have the HTML document, in i refered to the JS file. Other stuff working well, but this:

let messageEL = document.getElementById("message-el")

Always get this error:

ReferenceError: document is not defined

I installed live server, and it works one time, than stops.

What can I do, to fix this? Do I need to download some extension? Please tell me the solution as simple as u can Im at the beginning of the learning path.

This is the code and the error



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source