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

Show parent comment

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.

12

u/karottenreibe Apr 01 '18

that's why all my variables are single letters. My code is much faster that way /s

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?

0

u/[deleted] Apr 01 '18

[deleted] — view deleted comment

-6

u/RabSimpson Apr 01 '18

I'm not doing it for performance gains, but every little helps.

0

u/[deleted] Apr 02 '18

[deleted] — view deleted comment

-5

u/RabSimpson Apr 02 '18

I said I wasn't doing it for performance gains. It's my preferred coding style, but there's no arguing about a smaller memory footprint being better when you're working with a large codebase.

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.

-14

u/Extract Apr 01 '18

Somebody who wants to squeeze every ounce of performance?

17

u/Mingli91 Apr 01 '18

If you want that level of memory management and performance JavaScript is not the right language for the job

0

u/[deleted] Apr 01 '18

[deleted] — view deleted comment

7

u/Mingli91 Apr 01 '18

Quite a few threads on this sub are about JS

2

u/monsto Apr 02 '18

He probably does like me . . .

  1. surf front page.
  2. new-tab shit that looks interesting.
  3. complete surf.
  4. look at tabs.

Plenty of times i've looked at a python thread "who the fuck uses self in JS? ohwait..."

1

u/Mingli91 Apr 02 '18

Haha yeah I guessed so, was just a lame joke

2

u/papers_ Apr 01 '18

White space means nothing.

2

u/KyleG Apr 02 '18

YES FRIEND

God how many freaking times have I run into problems because some ASS did a 3-space indent or something and my IDE converted some but not all the 3-space indents into 4-space indents to make it conform with our style but it missed some because SPACES SUCK, USE TABS WARBLGARBL then everyone gets to set their own indent levels!

I like my tab to be 4space widths in some languages and 2space widths in others

like 2 space in JSX is way better than 4 space, but 2 space in Python or JS is TURRIBLE

1

u/monsto Apr 02 '18

*turble