Skip to main content

Difference between single quotes and double quotes in Javascript


I know that in PHP the only difference between double quotes and single quotes is the interpretation of variable inside a string.



Well, in jQuery Javascript, I often see doublequotes used in jQuery selectors, or in strings, is there a particular reason for that or is single quotes just the exact same as doublequotes?


Source: Tips4allCCNA FINAL EXAM

Comments

  1. You'll want to use single quotes where you want double quotes to appear inside the string (e.g. for html attributes) without having to escape them, or vice versa. Other than that, there is no difference.

    ReplyDelete
  2. There is a difference in JSON, so I have started switching to using double-quotes as much as possible so that I don't make mistakes when dealing with JSON.

    ReplyDelete
  3. Absolutly no difference. FREE QUOTING YEEHHAAA

    ReplyDelete
  4. They are the same, I usually use single quotes but thats because I am a .net developer and asp.net in particular so it aids me in distinguishing between the 2 types of strings.

    ReplyDelete

Post a Comment

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?