Mo. Mo. - 6 months ago 45
Javascript Question

Replace forward slash "/ " character in JavaScript string?

I have this string:

var someString = "23/03/2012";

and want to replace all the "/" with "-".

I tried to do this:

someString.replace(///g, "-");

But it seems you cant have a forward slash in there.



You need to escape your slash.