title: JavaScript: Uncaught SyntaxError: missing ) after argument list
body: <p>When I try to pass a string as an argument in the following function, I get the <code>Uncaught SyntaxError: missing ) after argument list</code> error. It works fine when passing integers though. I am confused because I read a string must be passed as the argument, and not an integer. </p>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>r.title = "The large item"
  counter = &lt;integer&gt;
  
  &lt;% @items.each do |r| %&gt;
    &lt;p&gt;Title: &lt;%= r.title %&gt;&lt;/p&gt;
    &lt;p&gt;Price: &lt;%= r.price %&gt;&lt;/p&gt;
    &lt;p&gt;Description: &lt;%= r.description %&gt;&lt;/p&gt;
    &lt;p style="color:blue;" class="room_&lt;%= counter %&gt;" onclick='addItemToCart(&lt;%= r.title %&gt;, &lt;%= counter %&gt;)'&gt;Select Item&lt;/p&gt;
    &lt;br&gt;
    &lt;br&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>When I pass <code>r.id</code> in place of <code>r.title</code>, the code works.</p>
  
  <p><strong>JavaScript:</strong></p>
  
  <pre><code>&lt;script text/javascript&gt;
    function addItemToCart(title, item_number){
      $("#" + item_number).append("&lt;br&gt;"+title);
    }
  &lt;/script&gt;
  </code></pre>