title: Why escape_javascript before rendering a partial?
body: <p>I'm looking at <a href="http://railscasts.com/episodes/136-jquery" rel="noreferrer">this Railscast episode</a> and wondering why the call to <code>escape_javascript</code> is needed here:</p>
  
  <pre><code>$("#reviews").append("&lt;%= escape_javascript(render(:partial =&gt; @review)) %&gt;");
  </code></pre>
  
  <p>What is <code>escape_javascript</code> used for?</p>
  
  <p>According to <a href="http://api.rubyonrails.org/classes/ActionView/Helpers/JavaScriptHelper.html#M001758" rel="noreferrer">the Rails docs</a>:</p>
  
  <blockquote>
    <p>escape_javascript(javascript)</p>
    
    <p>Escape carrier returns and single and
    double quotes for JavaScript segments.</p>
  </blockquote>
  
  <p>But that doesn't mean much to me.</p>