I want to search a function can replace all "?" in a string with an array position by position like below syntax:
replace("WHERE id > ? AND id < ?",[10, 20]);
with output will be:
"WHERE id > 10 AND id < 20"
I want to search a function can replace all "?" in a string with an array position by position like below syntax:
replace("WHERE id > ? AND id < ?",[10, 20]);
with output will be:
"WHERE id > 10 AND id < 20"
 
    
    I think it is same as this link
Replace multiple strings at once
    var find = "WHERE id > $ AND id < $"; 
    var replace = [10, 20] ;
 String.prototype.replaceArray = function(find, replace) {
      var replaceString = this;
      var regex; 
      for (var i = 0; i < find.length; i++) {
        regex = new RegExp(find[i], "$");
        replaceString = replaceString.replace(regex, replace[i]);
      }
      return replaceString;
    };
 
    
    