Consider, the following code:
var myVar = 'This is my text.\nAnd other information.\rHow to console.log\n\r?';
console.log(myVar);
Output:
This is my text.
And other information.
How to console.log
?
How can I console with the \n
, \r
& \n\r
?
I find myself using JSON.stringify
to print things like this.
Code:
console.log(JSON.stringify("i am a string!\nwith some newlines\r\n!"));
Output:
"i am a string!\nwith some newlines\r\n!"