Let's say I have something like this:
var array = [cat,dog,fish]; var string = 'The cat and dog ate the fish.';
I want to remove all these values ββfrom a string
var result = string.replace(array,"");
The result is: The and ate the .
At the moment, replace() only replaces a single value from the array. How can I make all / several values ββfrom an array be replaced in a string?
Thanks!
javascript jquery arrays replace
Bennett
source share