How are you running it? Did you try just opening the HTML file in the browser?
There is definitely nothing wrong with the code so it must be something else.
Just as an aside, I would suggest using HTML with a DOCTYPE to avoid it running in quirks mode. In VS Code inside the HTML file, you can just type ! and then press the tab key to get the correct HTML boilerplate code.
I don’t know if this will answer your question, but I do open the HTML in the default browser and that has been working fine, but the issue I’m having is viewing the JS console. What I’m trying to do is view whatever I put inside the console.log parenthesis to make sure I’m not accidentally creating any bugs along the way.
If I type: “console.log(1 + 2)”, it will display the result (3) just fine, but when I try to view the HTML variable line by typing “console.log(one)” after having assigned an HTML ID to a JS variable, it’ll say null.
Perhaps I haven’t installed the right extension? You know how on Scrimba for example you click Run after creating the same code on JS and it’ll display " <button id=“one”"> (please, ignore the second quotation mark, I just typed it so it would display the code)? That’s what I’d like to be able to see. So do I need another extension? Again, thanks for all your help.
Quokka is a Node.js repl used to run pure JS. It doesn’t let you use browser APIs which is what getElementById is. For that, you need to emulate a browser-like environment (using JSDOM).
In any case, I wouldn’t suggest using Quokka for that. Just serve the HTML with VS Code using an extension like Live Preview, or Live Server/Five Server.
Awesome. Thank you! I’ve installed Live Preview, then, I press Ctrl + Shift + P and type: “Live Preview: Start Server Logging” from the JS file, but I still can’t view the console.log. Would you please tell me what I need to do so I can view it? I wouldn’t want to compare, but is it possible to view it the same way it’s viewed on Scrimba?
Again, thank you!
I think I’ve got it. Thank you so very, very much! I’ve spent so many hours watching YT videos one after another trying to find the way to get to this and it’s finally done! Again, thank you!! 8D