What can make document.write undefined? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What can make document.write undefined?

I was writing a very simple code but this notification keeps coming that document is undefined :/ (The document of document.write)

25th Jul 2019, 7:33 AM
blue-candy
blue-candy - avatar
10 Answers
0
Try console.log()
25th Jul 2019, 7:36 AM
Julian Dörling
Julian Dörling - avatar
0
Now it says console is undefined.
25th Jul 2019, 7:39 AM
blue-candy
blue-candy - avatar
0
Can i have a look at your code?
25th Jul 2019, 7:40 AM
Julian Dörling
Julian Dörling - avatar
0
It's like var name='Bob'; console.log(name); Or document.write(name)
25th Jul 2019, 7:44 AM
blue-candy
blue-candy - avatar
0
var name = "Bob"; document.write(name);
25th Jul 2019, 7:47 AM
Julian Dörling
Julian Dörling - avatar
0
The code i send should work
25th Jul 2019, 7:48 AM
Julian Dörling
Julian Dörling - avatar
0
var name = "Bob"; document.write(name); Does this work for you in code playground?Because it doesn't for me.
25th Jul 2019, 8:02 AM
blue-candy
blue-candy - avatar
0
Yes it works. Are you sure you are using js and not java?
25th Jul 2019, 8:03 AM
Julian Dörling
Julian Dörling - avatar
0
It works for me too but not in computer. Maybe I should use another text editor.
25th Jul 2019, 8:18 AM
blue-candy
blue-candy - avatar
0
On computer you can use Visual Studio code. But when you write in js you have to include it in Html.
25th Jul 2019, 8:23 AM
Julian Dörling
Julian Dörling - avatar