0

Why this "\n" doesn't create line break in Vscode? But it create a line break in sololearn?

27th Feb 2021, 4:42 PM
Noname
Noname - avatar
9 odpowiedzi
+ 2
Can you share the code which you have written in Vs code ide?
27th Feb 2021, 4:44 PM
Atul [Inactive]
+ 1
I guess that if you run you code locally under window, new lines require "\n\r" (or "\r\n", doesn't remember)... I guess also that in C++ endl should output platform agnostic right new line sequence ;)
27th Feb 2021, 7:18 PM
visph
visph - avatar
+ 1
visph yes I have a new line Thanks a lot
28th Feb 2021, 12:48 PM
Noname
Noname - avatar
28th Feb 2021, 10:24 AM
Noname
Noname - avatar
0
visph this create space between the words on JS (using vs code
28th Feb 2021, 10:27 AM
Noname
Noname - avatar
0
Atul how can I share it?
28th Feb 2021, 10:29 AM
Noname
Noname - avatar
0
are you writting html document? if so, that's the normal behavior of almost all elements to be rendered by transforming new lines to spaces and compress multispaces to once... pre-formatted text should be wrapped inside <pre> tag to correctly render line breaks, or style it with css white-space property set to pre or pre-wrap...
28th Feb 2021, 12:35 PM
visph
visph - avatar
0
visph I have linked a JS file with my html file It's not in the html file
28th Feb 2021, 12:39 PM
Noname
Noname - avatar
0
yes, but is the js file wich output '\n' changed to spaces? probably because you're outputting it inside the html... what if you make an alert('hello\nworld'); did you get the new line?
28th Feb 2021, 12:42 PM
visph
visph - avatar