turingschool-examples / intermission-assignments

33 stars 218 forks source link

Airbnb's JS style guide #11

Closed EmilyMB closed 9 years ago

EmilyMB commented 9 years ago

Discuss Airbnb's JavaScript style guide here. In particular, when you glanced over the style guide, which aspects made you jump out of your chair and say "YES!" and which ones made you grumble in quiet, reserved discontent?

EmilyMB commented 9 years ago

Grumble: For multi-line strings, I'm not sure why they prefer string concatenation ("+") to splitting with "\". Happy about: most of it, especially descriptive naming.

nathanows commented 9 years ago

Not sure my JS is strong enough to have any real opinion on any of these but... yeah.

KristaANelson commented 9 years ago

I actually really appreciate this guide! I love that they show bad examples and good examples for each topic! I also like that they point out what not to make things. I never know and then get weird things happening because I ised a key word. I'm not sure if I get the difference when to use the dot notation yet vs subscript. Hopefully that will click.

Hoisting confuses me.

this. I'm also still getting familiar with. I was thinking it was just like self in Ruby but now I'm not so sure.

Bookmarking this!

Lydias303 commented 9 years ago

I am still confused about hoisting... I think I may prefer the explanation in chapter 15 about hoisting better this one.

I like the examples! I think I will definitely be referring back to this.

I like the comment prefix's. I think that is good for clarity.

Call me crazy but I see zero difference between the 3 examples on "End files with a single newline character." // bad (function(global) { // ...stuff... })(this);

// good (function(global) { // ...stuff... })(this);↵

laurawhalin commented 9 years ago

This stylesheet seems to help you avoid some common pitfalls, unlike the thoughtbot guide for ruby, which just made clear some style choices. One place I really noticed this was in the Constructors section, when assigning methods to the prototype object. Definitely a good reference, especially seeing how many other companies use it!

bmrsny commented 9 years ago

I like the examples. I think for someone who may be new to a language can benefit a lot, I know I did. Some of these were a little more confusing, and took more glancing over. I did find a few spots where they suggested //bad, then a few examples later they would make a case for why it is ok. Think my JavaScript skills need some more work. Will be referencing more!

mikedao commented 9 years ago

I don't think that I am familiar with Javascript enough to really have an informed opinion, but I'll certainly follow the style guide, much smarter people than I came up with it, so I'm sure they had good reasons for their choices.