r/javascript • • Apr 01 '18

Google publishes a JavaScript style guide. Here are some key lessons.

https://medium.freecodecamp.org/google-publishes-a-javascript-style-guide-here-are-some-key-lessons-1810b8ad050b
714 Upvotes

317 comments sorted by

View all comments

24

u/e_man604 Apr 01 '18

Why is single quote (') preferred over double quote (") ? For me it makes sense to use double to remain same when dealing with c++ for instance.

67

u/[deleted] Apr 01 '18

"Being same as C++" should be quite low in priority for a JavaScript style guide.

One reason why single quotes is no shift. It's faster to type, and who cares what it is, anyway, as long as it's consistent.

1

u/JESUSgotNAIL3D Apr 01 '18

Ahhhhh damn. I like keeping my double quotes from C++ (new JS guy here). Looks like I'll join the single quote crowd if that's preferred in the community.... damn!

5

u/azium Apr 01 '18

just use prettier and forget about everything else. hit save and keep coding

2

u/wavefunctionp Apr 01 '18

I agree. I don't care about too much about style. I just prefer not to be too weird, easy to change/diff the code, like dangling commas, and automated through the editors on save or with a hotkey.