@GurudayalKhalsa I would say pick any and be consistent.
Generally its a convention to use " in html and if you have inline html in your js (we all have some, don't we? ) its easier to quote it all with a single ', without a lot of \
@GurudayalKhalsa, single-quoted strings look better for me
1) " ===
2) In PHP single-quoted strings are just plain strings, double-quoted strings allow to put variables inside and therefore work a bit slower. So it is just a habit to use single-quotes.
Just to add up, straight from coffeescript docs.
Ruby-style string interpolation is included in CoffeeScript. Double-quoted strings allow for interpolated values, using #{ ... }, and single-quoted strings are literal.
Single and double quoted strings behave _exactly the same way_ in JS, but I got used to the coffee way and now its natural to write it that way..
This a preference. The important thing, as @jaseemabid points out is consistency. At Airbnb we use '' which is what is reflected in the style guide.
Feel free to fork the style guide and make one that prefers "" over '' for you and your team.
One could use single-quote strings only if there are double quotes in the string, and use double-quote strings otherwise. It would still be consistent, though the rule maybe less obvious, and you lose an excuse for not double-quoting strings in many cases.
The eslint rule allows for double quotes when it would avoid escaping backslashes.
However, since both straight quotes are typographically incorrect - you should be using curly quotes in prose - this is only a problem when working with strings of html, which double-quotes it鈥檚 attributes. Thus, it鈥檚 basically never a problem with correct code/text.
Most helpful comment
This a preference. The important thing, as @jaseemabid points out is consistency. At Airbnb we use
''which is what is reflected in the style guide.Feel free to fork the style guide and make one that prefers
""over''for you and your team.