I\'m trying to do replace in JavaScript using:
r = \"I\\nam\\nhere\"; s = r.replace(\"\\n\",\" \");
But instead of giving me
use s = r.replace(/\\n/g," ");
s = r.replace(/\\n/g," ");
Get a reference:
The "g" in the javascript replace code stands for "greedy" which means the replacement should happen more than once if possible