replaceall in javascript example

ReplaceAll method in java script.

function ReplaceAll(content,findWith,replaceWith){
  var str = content;
    var index = str.indexOf(findWith);
        while(index != -1){
            str = str.replace(findWith,replaceWith);
            index = str.indexOf(findWith);
        }
        return str;
}