I have the following string
var str = "this---is--- a --- test d ---";
I want to remove all the -
and replace by nothing.
I tried using
var str = "this---is--- a --- test d ---";
var res = str.replace("-", "");
but res do not change...
if I do
var str = "this---is--- a --- test d ---";
var res = str.split('-').filter(e => !!e).join();
it does work.
Why the replace is not ?