title: JavaScript String.raw to not process substitutions to get the "raw" raw string?
body: <p>I'd like to use a user provided string as argument for a JavaScript function and hence need to escape all characters that could cause the script to break.</p>
  
  <p>This is for a Swift to JavaScript bridge to be used with <code>WKWebView.evaluateJavaScript()</code> that processes raw JavaScript.</p>
  
  <pre><code>window.someObject.method( ... user provided string ... )
  </code></pre>
  
  <p>The string can contain anything, line breaks, double quotes, backticks, unicode escape sequenced, substitutions, etc. </p>
  
  <p>Currently I use a template literal and escape:</p>
  
  <ul>
  <li>\ with \\ (single backslash with double backslash)</li>
  <li>${ with \${</li>
  <li>` with backslash+backtick </li>
  </ul>
  
  <p>I'm trying to get this to work with <code>String.raw</code>, but I cannot figure out how to escape substitutions.</p>
  
  <p>Potential user input:</p>
  
  <pre><code>hello ${1+1}
  </code></pre>
  
  <p>I want that exact string as argument to my JavaScript function, no substitutions being processed.</p>
  
  <p>Here is what I tried:</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>// User input is: hello ${1+1}
  console.log(String.raw`hello ${1+1}`)
  console.log(String.raw`hello \${1+1}`) // So close, but not quite
  
  console.log('I want: hello ${1+1}')</code></pre>
  </div>
  </div>
  </p>
  
  <p>What I want is this:</p>
  
  <pre><code>window.someObject.method( String.raw`hello ${1+1}` ) → hello ${1+1}
  </code></pre>
  
  <p>Is this possible at all?</p>