In JavaScript, I have strings including newlines such as var s = "123\n456"
or var s = "123\r\n456"
.
Using console.log(s)
, the dev tools of a browser displays real newlines in console.
I would like to know how to print literally the string. For instance, I want to see 123\n456
or 123\r\n456
in dev tools or a browser.
Could anyone help?