is there any difference between $(" ")&$(' ')? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

is there any difference between $(" ")&$(' ')?

bcz when i use $(" ") or $(' ') in jquery the answer are same.

21st Aug 2017, 1:22 PM
polly zjy
polly zjy - avatar
4 Answers
+ 13
It is recommended to use double quotes but there's no difference at all. Might be interesting to know that a test made by a StackOverflow user says that single quotes read faster the data inside parenthesis, naturally we talking about milliseconds and you do not really need to be worried about, if you're curious just visit the following links. Comparison: http://jsfiddle.net/5HhWF/1/ jQuery Style Guide: http://contribute.jquery.org/style-guide/js/#quotes
21st Aug 2017, 1:24 PM
Maz
Maz - avatar
+ 9
@Lord, thanks for share!
21st Aug 2017, 2:41 PM
Maz
Maz - avatar
+ 8
@Maz i checked the test comparison. ran the test with the same text 'single quote' the result was double quote was a little bit faster than single quote text some 10 milliseconds. https://s20.postimg.org/s9zgduewd/Screenshot_20170821192450.jpg
21st Aug 2017, 2:00 PM
Lord Krishna
Lord Krishna - avatar
+ 2
for js it's no difference
21st Aug 2017, 1:23 PM
Yaroslav Pieskov
Yaroslav Pieskov - avatar