Skip to content
Advertisement

Javascript can’t replace string

_.replace() doesn’t replacing anything in string. I tried like 5 different ways to do it but still nothing and I guess you are my last hope.

My code:

JavaScript

I want to get rid of <br />

Output: output

Advertisement

Answer

You need to pass a regular expression with global flag to replace all occurrence of a pattern.

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement