How do I replace ' in javascript. For example I want to convert O'conor to O-conor. This doesnt work. I am doing something stupid.
var dummyStr = "O'conor";
dummyStr.replace("'","-");
console.log(dummyStr); //prints O'conor
dummyStr.replace(/'/g,"-"); //still prints O'conor not O-conor
Please mark duplicate if this has already been asked elsewhere.