Any difference of single quotes and double quotes ? ' and " | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Any difference of single quotes and double quotes ? ' and "

Any diff while making string or any performance diff ?

15th Oct 2016, 7:07 PM
Suryaprakash Tiwari
Suryaprakash Tiwari - avatar
5 Answers
+ 4
Generally, single quotes are used to enclose a character and double quotes are used to enclose a string. In JavaScript, a string with single quotes can be represented in double quotes and a string with double quotes can be represented in single quotes.
24th Nov 2016, 10:35 AM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 3
No, there is no difference. I usually use double quotes so that I don't have to escape all of the single quotes in the Engligh language. But in the end it comes down to preference. ES6 allows you to use a third alternative, called template strings. This is done by using back-tics. For example: `string goes here`. This also has many other advantages that you can read more about online. :)
25th Oct 2016, 6:08 PM
Alex
Alex - avatar
+ 1
in JS no in other languages like SQL or c# yes
29th Oct 2016, 2:50 AM
Shekhar Bahuguna
Shekhar Bahuguna - avatar
0
No there is no difference between single and double quotes
24th Nov 2016, 3:04 PM
joffie
joffie - avatar
24th Nov 2016, 8:48 PM
Rasheed Khan
Rasheed Khan - avatar