Himmators
Himmators

Reputation: 15006

What is the ↵–character in chrome console?

I'm pulling in some data from an api and console.log in chrome:

Chrome prints it like asdföklajsd↵New line!

I would like to replace the ↵ character with a <br /> using replace in javascript. How do I reference that character?

Upvotes: 25

Views: 25428

Answers (1)

Cerbrus
Cerbrus

Reputation: 72857

It's a return character.

Try replacing them like this:

myString = myString.replace(/(\r\n|\n|\r)/gm, "<br />");

Upvotes: 47

Related Questions