I would like to take text that I generated and stored in a string and use it like a template literal.
var generatedText = \"Pretend this text was generated
You should emulate a template literal instead, because letting text from ~somewhere~ run arbitrary JavaScript like a real template literal’s ${} sections can usually isn’t a good idea:
${}
generatedText.replace(/\$\{variable}/g, variable);