Home How to replace all occurrences of a string in JavaScript?
Reply: 0

How to replace all occurrences of a string in JavaScript?

user340
1#
user340 Published in June 20, 2018, 7:20 am

I have this string:

"Test abc test test abc test test test abc test test abc"

Doing

str = str.replace('abc', '');

seems to only remove the first occurrence of abc in the string above. How can I replace all occurrences of it?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.488621 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO