How do I run this code on an actual website?


#1

I tried putting the code in my website's code, but it only gives me the prompt and doesn't print out anything else.


#2

If the prompt comes up, then you've done it right, but unfortunately console.log() has no effect in webpages, as they are not consoles. You can substitute this for document.getElementById().innerHTML = () You can edit HTML elements such as paragraphs or headings using this method, and I've found it to be very useful. I am currently on my phone and can't really give you a full example, but when I get home later I will help you more.