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

81

u/tencircles Apr 01 '18

I don't get the 2 spaces thing. It makes code harder to read. 4 is best. Don't even @ me.

57

u/the_argus Apr 01 '18

I agree, except tabs are king bc then everyone can set their own indentation level.

14

u/RabSimpson Apr 01 '18

And they only occupy a single character worth of storage and memory. This doesn't mean much on small projects, but if the project is large it could shave the loading time down.

26

u/subtracterall hire me! Apr 01 '18

This shouldn't matter if you're minifying/uglifying.

7

u/RabSimpson Apr 01 '18

Only in the case of client-side code. Who minifies server-side code?

1

u/the_friendly_dildo Apr 02 '18

Someone selling a server-side product that wants to maintain some semblance of 'fuck you i'm in control' over a product.

2

u/RabSimpson Apr 02 '18

Don't they usually just throw it through Zend or ionCube in those cases?

1

u/the_friendly_dildo Apr 02 '18

I haven't used either but those are both used only for PHP aren't they?

2

u/RabSimpson Apr 02 '18

I think so. I've only ever seen them used with PHP.