e></pre>
<p>Nonetheless, it is doable with htmlwidgets’ serialiser (and only that one). The function <code>htmlwidgets::JS</code> can be used to mark a character vector so that it will be treated as JavaScript code when evaluated in the browser.</p>
<div class="sourceCode" id="cb173"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb173-1"><a href="advanced-topics.html#cb173-1"></a>htmlwidgets<span class="op">::</span><span class="kw">JS</span>(<span class="st">&quot;var x = 3;&quot;</span>