In Node.js is there any way to print the \n \r on console?

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!"

Got some solution:

Code:

var myVar = 'This is my text.\nAnd other information.\rHow to console.log\n\r?';
console.log(require('util').inspect(myVar, { showHidden: true, depth: null }));
console.log('----------------');
console.log('Just console.log');
console.log(myVar);

Output:

This is my text.\nAnd other information.\rHow to console.log\n\r?
----------------
Just console.log
This is my text.
And other information.
How to console.log
?

Other ways are also welcomed.

as far as I know, if you output some special chars in your console.log

example : % is in fact a control caracter for console log you have to urlencode it to : %25

because %c does the css formating of your output, as an example

the line feeds will not be displayed as so