title: Check if string is enclosed in single quotes Javascript
body: <pre><code>// 'Apple' : valid
  // 'Apple : Invalid
  // Apple : Invalid
  
  if(str.indexOf('\'') &gt; -1 &amp;&amp; str.indexOf('"') &gt; -1){
     // do something
  }
  </code></pre>
  
  <p>This will detect if the string contains single and double quotes. </p>
  
  <p>How to check if string starts and ends with a single quote. (Regexp)?</p>