I would like to replace multiple words from below string:
If you want to replace all
\n without calling replace in a loop you have to use a regular expression. You can use it like this:
var test = "\njava developer\n"; var result = test.replace(/\n/g, '');
g in the regular expression means replace all occurrences.
Hope this helps.