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

3

u/bio595 Mar 28 '15 edited Mar 28 '15

I'm not a massive fan of marking private variables on this with leading underscores. I prefer to create a variable in the closure scope.

It prevents someone from changing it when you don't expect them to.

2

u/theycallmemorty Mar 28 '15

Me too but it really ties you're hands of you want to inherit from the class down the road.

2

u/[deleted] Mar 28 '15

[removed] — view removed comment

2

u/bio595 Mar 28 '15

Agreed, private means private, not protected (which doesn't really make sense in js anyway)