Alex Rivera | Logout

Displaying control characters in Chrome's console?

Asked 2012-10-09T04:17:04.723
8

Is there any way to force Chrome's JS console to display newlines like Firefox?

Chrome:

enter image description here

Firefox:

enter image description here

Possibly a hidden switch somewhere?

Edit
Report

1 Answer

0

You can try this way

var x = 'a\\nb';

EDIT:

You can use hexadecimal character in string.

\ = '\u005C'
> var x = 'a\u005Cnb';
> x
<- "a\nb"
> x === "a\nb" is false.
> x === "a\\nb" is true or x === 'a\u005Cnb' is true.

You can take a look at links.

http://mathiasbynens.be/notes/javascript-escapes http://code.cside.com/3rdpage/us/javaUnicode/converter.html

answered 2012-10-09T04:22:38.093

Your Answer