6 ms·
The reason I’ve used (and stuck to) single over double is it’s easier to embed JavaScript within html (html convention being double). It can get cluttered when
by __oh_es 8y ago
The reason I’ve used (and stuck to) single over double is it’s easier to embed JavaScript within html (html convention being double).
It can get cluttered when with nested quotes, but most linters will allow you to use the other type to encapsulate.
IMO it doesn’t matter, as long as the team agrees and remains consistent throughout the codebase.
- arethuza 8y agoThanks - that's a decent explanation for favouring one over the other. I rather dislike "best practices" that don't provide any explanation of what they are recommending.
- jrockway 8y agoI mean, it's because it doesn't matter. Picking one is valuable for consistency (no odd diffs when refactoring). Which one you pick doesn't matter.
- chrisweekly 8y ago... Unless you would prefer to skip the extra keypress required for ".
- ficklepickle 8y agoThe behavior is slightly different. "\n" is a newline, '\n' is a backslash and an n.
- lauritzsh 8y agoNot in JavaScript. \n is treated as a newline in both cases. Try it out in the console.