title: How to assign a string to a variable in javascript when the string has a single quote in it
body: <p>In my program there is a variable name 'quotes' which takes an input string from an API call.<br>
  <strong>Program doesn't work when the string has a single quote in it.</strong> <br> </p>
  
  <pre><code>&lt;script&gt;
      var quotes = "Empty"
          if(user.quotes)
             quotes = user.quotes;    // get the string to 'quotes' variable
  &lt;/script&gt;
  </code></pre>
  
  <p>can any one please tell me how to fix this problem?</p>