I\'m trying to do replace in JavaScript using:
r = \"I\\nam\\nhere\"; s = r.replace(\"\\n\",\" \");
But instead of giving me
You can use:
var s = r.replace(/\n/g,' ').replace(/\r/g,' ');
because diferents SO use diferents ways to set a "new line", for example: Mac Unix Windows, after this, you can use other function to normalize white spaces.