document.write is wrong? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

document.write is wrong?

When i use document.write in other javascript console (not sololearn) it keep saying error Does it mean that this is wrong?

1st Jun 2018, 3:00 AM
Fajar Kurniawan
7 Answers
+ 3
NoobGamer_17 It is possible that your app doesn't link the script file to a HTML document. The 'document' identifier refers to the HTML document object. document.write() writes to the HTML document. If this is the case, you can use console.log() instead, which writes to the JS console.
1st Jun 2018, 6:06 AM
Hatsy Rei
Hatsy Rei - avatar
+ 4
Possibly an instance of https://stackoverflow.com/questions/3236353/javascript-document-write-error It would help if you posted your code and the error message (if you received any).
1st Jun 2018, 4:27 AM
Hatsy Rei
Hatsy Rei - avatar
+ 2
Thanks Hatsy Rei
1st Jun 2018, 1:05 PM
Fajar Kurniawan
+ 1
i can't post it because i do it on many other console, and app (Not SoloLearn)
1st Jun 2018, 5:47 AM
Fajar Kurniawan
+ 1
Hatsy Rei i use an app on android Named "CODE", and some other apps, they(the apps) think that the "document" on "document.write is a variable". It says "An error has occured, variable "document" is undefined
1st Jun 2018, 6:00 AM
Fajar Kurniawan
+ 1
but when i try on SoloLearn, it works without error
1st Jun 2018, 6:01 AM
Fajar Kurniawan
0
WAIT it was the drake meme lol 😁
1st Jun 2018, 6:10 AM
New_user28
New_user28 - avatar