Most of the style guides and linters recommend using single quotes, any idea on the advantage of each?
Most of the style guides and linters recommend using single quotes, any idea on the advantage of each?
However, single quotes have two advantages (IMO, since this is obviously subjective):
1. can be typed without shift on US keyboard layout
2. I use double quotes inside string literals (e.g. for quoting bad input in error messages) more often than single quotes (mostly used for contractions) so not having to escape double quotes by default is convenient.
Standard (and I guess eslint?) support "single quotes unless a single quote appears in the string", which is ideal (for me).
One reason I can think of why people use double quotes is because JSON only supports double quotes and it's not uncommon to deal with JSON when you program in JS.