r/javascript • • Mar 27 '15

Airbnb JavaScript Style Guide - A mostly reasonable approach to JavaScript

https://github.com/airbnb/javascript/blob/master/README.md
315 Upvotes

158 comments sorted by

View all comments

10

u/nawitus Mar 27 '15

Mostly good stuff.

I prefer String(foo) instead of '' + foo.

I think 4 spaces are better than 2.

'collection.length > 0' is perfectly reasonable, there's no need to use shortcuts whenever possible.

I've always used "that" over "_this", but these days this is rarely needed thanks to the fat arrow syntax.

14

u/Ryckes Mar 27 '15

I think 2 spaces make it difficult to guess which block a given statement belongs to. 4 spaces is perfect for me.