msg.replace('{:curQuantity}', quant); msg.replace('{:newQuantity}', '12'); msg.replace('{Date1}', startDay); msg.replace('{Date2}', endDay); 

The point is to replace all entries in this line with a value. But for some reason, replace () did not really want to change. For the line, you can take this value:

 var msg = '{:curQuantity} bottles currently in stock. Order {:newQuantity} bottles and your items will ship {Date1} – {Date2}'; 

1 answer 1

Understood ... Entered one more variable, and kept state in it.

  var message = msg.replace('{:curQuantity}', quant); message = message.replace('{:newQuantity}', '22'); message = message.replace('{Date1}', startDay); message = message.replace('{Date2}', endDay);