0
Why does this not have an output?
4 Respostas
0
It's because you're trying to right HTML code in JavaScript, which results in an error. All you would need to do to output something in JS is by writing document.write("text"); and it will output whatever is in the quotations.
+ 3
Code playground web projects act as it handle 3 virtual files in 3 tabs: html hold the html code, css expect only css as a standalone css file, and js expect only js as a standalone js file... both last ones are silently linked to first, as they was linked (with <link> for css, and <script> for js) at the end of the <head> part.
Anyway, the document.write() method is not at all a good one to interact with the web document content, but if you want even so, simply move your code from the js tab to the html tab (including the <script> part and its document.write() content) ;)
+ 1
Thanks.
0
No problem! 😉👍