does document.write() doesnot support escape character in it?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

does document.write() doesnot support escape character in it??

document.write("hello \n world"); doesnot shows in two different lines..why?

1st Jul 2016, 1:35 PM
Shubham Raja Shrivastava
Shubham Raja Shrivastava - avatar
3 Answers
+ 1
document.write("Hello<br>World!");
2nd Jul 2016, 12:31 PM
ZinC
ZinC - avatar
+ 1
@Name document.write outputs to HTML document. How's console.log going to do that? I'm aware of the fact that experts don't want us to use 'document.write' alltogether, but 'console.log' isn't an alternative.
2nd Jul 2016, 5:28 PM
ZinC
ZinC - avatar
- 2
u need to put document.write("hi there \n hi") not document.write("hi there /n hi") the /n should be \n. I hope i helped you
1st Jul 2016, 10:15 PM
aiden
aiden - avatar