Difference between single quotes and double quotes in Javascript [duplicate]

Solution 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.

However, note that JSON (JavaScript Object Notation) only supports double quoted strings.

Solution 2:

There is a difference in JSON - The JSON standard specifies that all key,value pairs should be in double quotes. (thanks to wulfgarpro in the comments), so I have started switching to using double-quotes as much as possible so that I don't make mistakes when dealing with JSON.