Can't use document.write | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can't use document.write

Is not defined shows the compiler

8th Feb 2021, 5:39 PM
Marcelo Diaz
Marcelo Diaz - avatar
3 Answers
0
it works, may be you have something mistyped. https://code.sololearn.com/WA3DJMFkcprI/?ref=app
8th Feb 2021, 6:20 PM
Bahhaⵣ
Bahhaⵣ - avatar
0
document is defined only inside browsers for html documents (web: html/php)... if the error you get is about document is undefined, then you're probably in a nodejs project (else it's not js), where there's no document (so no method document.write), and you should use console.log (wich is also available in browsers) method to do output ;P
8th Feb 2021, 8:51 PM
visph
visph - avatar
0
Thanks
10th Feb 2021, 2:52 AM
Marcelo Diaz
Marcelo Diaz - avatar