Example:
var i = 'Hello \n World'
console.log(i)
Would return:
Hello
World
and I want it to return
Hello \n World
not rendering the new line, as I intend to store this in a database.
FOR THOSE WHO WANT TO STORE \n
in Database
You don't need to escape, as your Document Database will do JSON.stringify
, I use ArangoDB and it works perfectly fine, thanks to @PaulPro