-1

I am beginner in JavaScript and I am wondering why string literals with single and double quotes still live together? There already was a discussion on StackOverflow about which are better to use in certain situations, but why a majority of other languages do not have such feature, despite it is still an official JavaScript standard? It is much interesting to know - I do not believe this feature is some "rudimentary" stuff left from older versions. Thorough explanations are appreciated.

Community
  • 1
  • 1
Ilya Tereschuk
  • 1,204
  • 1
  • 9
  • 21
  • Unless [Brendan Eich](http://en.wikipedia.org/wiki/Brendan_Eich) chooses to come by and answer, this is purely a discussion of the possible intent of a language-feature. Which is not really appropriate to this site. – David Thomas Dec 29 '13 at 13:32
  • so what is the problem with that? –  Dec 29 '13 at 13:34
  • in a lot of situations this feature is very useful :) it let us less string manipulations, so i admire it is still there – A.T. Dec 29 '13 at 13:35

1 Answers1

4

I am wondering why string literals with single and double quotes still live together?

I'm not following your "still" in that sentence. JavaScript was originally defined to have two kinds of quotes so that it's easier to do quoted quotes, and there's no reason to change that. There are lots of reasons not to change it. (Not least that it's useful. But also removing it would break a truly huge amount of code.)

...why a majority of other languages do not have such feature...

In most languages syntactically derived from B (as JavaScript is, like C, C++, C#, and Java), single quotes are used for character literals. But JavaScript doesn't have characters, just strings, so the single quotes aren't needed for that purpose.

...despite it is still an official JavaScript standard?

Yes, it's in the specification and that won't be changing.

T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875