My assumption is that for JS single quotes are used because double quotes are the standard for HTML, and this allows for easier use of JS code in HTML attributes for JS events (e.g. onclick=&quot;alert(&#x27;foo&#x27;);&quot;).<p>I assume JS allows both because of the languages that came before, such as Perl, where it was a convenience to make it easier to include either double quotes or single quotes (contractions) within a string without escaping (but Perl goes <i>much</i> farther than that with the q and qq operators).<p>In other languages, such as C&#x2F;C++ single quotes aren&#x27;t used for string, but for character literals.