0
I have a problem
I don't know but somehow js is not working on my vscode or maybe I am doing something wrong because it shows me a mistak when I code var= 10; document.write(x); it says that document is not defined
3 Respostas
+ 2
Are you using vscode to execute js code?
document object is not available in runtime environments, that's why it says 'document' is not defined
"When an HTML document is loaded into a web browser, it becomes a document object" - W3Schools
Link your script with HTML and then load it in browser!
See this for more info: https://dev.to/artemismars/nodejs-and-dom-api-2iim
+ 1
var x = 10
// var = 10
0
If there is no document (html), just output to console instead: console.log()