Hacker News new | past | comments | ask | show | jobs | submit login

Single quotes have been mainstream in JS for much longer than AirBnB has been around. Take for example, the Google style guide[1]:

> For consistency single-quotes (') are preferred to double-quotes ("). This is helpful when creating strings that include HTML

Or take the oldest version of Prototype JS I could find (a JS library from the old days), version 1.5 from Jan 2007[2]. A simple search of the source shows 690 occurrences of ' and 48 occurrences of ". jQuery 1.0, dated 2006[3] is a counter example which has many more occurrences of double quotes, but I believe single quotes were generally more common even before that.

I think, in addition to the HTML thing mentioned already, PHP also had a lot to do with it, since single quotes would be encouraged in PHP when you just want a plain string.

[1] https://google.github.io/styleguide/javascriptguide.xml?show...

[2] http://prototypejs.org/assets/2007/1/18/prototype.js

[3] https://code.jquery.com/jquery-1.0.js




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: