I'm trying to create a find and replace program. The problem is that everything that goes inside the global match modifier is converted to a string. How do I prevent that so I can use a variable as the value of the global match modifier?
the code :
function replaceHim() {
    var para = document.getElementById("para");
    var replaced = document.getElementById("firstInput").value;
    var replaceWith = document.getElementById("secondInput").value;
    var paraValue = para.innerHTML.replace(/replaced/g,replaceWith);
    para.innerHTML = paraValue;
}
 
     
     
    