3 ms·
That whole issue is arguably old JavaScript. It was because HTML style preferred double quotes so using since quotes in JS made that easier. Modern Javascript
by tokyodude 8y ago
That whole issue is arguably old JavaScript. It was because HTML style preferred double quotes so using since quotes in JS made that easier.
Modern Javascript has template literals using backticks so arguably the new rule should be used double quote everywhere except use a template literals for HTML or whenever doing string manipulation.
The number one thing I hate about using single quotes it is matches almost no other languages so it ruins muscle memory if switching between languages.
JS itself prefers double quotes. See JSON.stringify or log anything to the console that gets auto quoted, always uses double quotes
- marcosdumay 8y agoIt matches SQL, that is the one language one is most likely to write at the same time as any other language.
- kiriakasis 8y agoThe fact that JSON.stringify uses double quotes is slightly in favour of using single quotes in handwritten code