title: How to insert JavaScript code in a Handlebars template?
body: <p>Quoting <a href="https://github.com/wycats/handlebars.js/blob/master/FAQ.md" rel="nofollow noreferrer">Handlebars FAQ:</a></p>
  <blockquote>
  <p>How can I include script tags in my template?</p>
  <p>If loading the template via an inlined  tag then you may need to break up the script tag with an empty comment to avoid browser parser errors:</p>
  <pre><code>&lt;script type=&quot;text/x-handlebars&quot;&gt;
    foo
    &lt;scr{{!}}ipt src=&quot;bar&quot;&gt;&lt;/scr{{!}}ipt&gt;
  &lt;/script&gt;
  </code></pre>
  </blockquote>
  <p>Nevertheless, I can't seem to be able to implement this:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>document.getElementById('output').innerHTML = 
    Handlebars.compile(
      document.getElementById("template").innerHTML
    )({});</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.10/handlebars.js"&gt;&lt;/script&gt;
  
  &lt;script id="template" type="text/x-handlebars"&gt;
    foo
    &lt;scr{{!}}ipt&gt;
      alert("Yay!");
    &lt;/scr{{!}}ipt&gt;
  &lt;/script&gt;
  
  &lt;div id="output"&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>As you can see no <code>Yay!</code> is alerted.</p>
  <p>How to make this work?</p>