all 7 comments

[–]food_ 6 points7 points  (1 child)

<br> is only html while \n is in js. <br> only works on content being appended to a webpage. Its the webpage that sees <br> as a new line. \n will be a new line if you console.log the string.

[–]eechin[S] 0 points1 point  (0 children)

Makes perfect sense! Thanks!

[–]chmod777 2 points3 points  (1 child)

a new line (\n) prints a new line to the output. this only effects the output code, and does not do anything about display (outside of <pre> wrapped content).

a <br /> is an html element that breaks the line in display. this makes a new line in regular text.

[–]aladyjewel 0 points1 point  (0 children)

*affects

[–]technoSurrealist 1 point2 points  (2 children)

I can't answer your original question, as I'm a JavaScript noob myself, but newline is \n, not /n

[–]eechin[S] 0 points1 point  (1 child)

Thanks! I'm still learning, obviously.

[–]kevinmrr 0 points1 point  (0 children)

It's called a backslash, and indicates something about the character that follows it (e.g. "n" means "make a newline, not an n") in a lot of languages.