News for hackers. Stuff that matters.
Re:Show HN: Learn and practice modern JavaScript by __oh_es on Thursday January 03, 2019 @10:30AM (#18815784)
The reason I’ve used (and stuck to) single over double is it’s easier to embed JavaScript within html (html convention being double).

It can get cluttered when with nested quotes, but most linters will allow you to use the other type to encapsulate.

IMO it doesn’t matter, as long as the team agrees and remains consistent throughout the codebase.

Re:Show HN: Learn and practice modern JavaScript by arethuza on Thursday January 03, 2019 @10:37AM (#18815852)
Thanks - that's a decent explanation for favouring one over the other.

I rather dislike "best practices" that don't provide any explanation of what they are recommending.

Re:Show HN: Learn and practice modern JavaScript by jrockway on Thursday January 03, 2019 @10:44AM (#18815908)
I mean, it's because it doesn't matter. Picking one is valuable for consistency (no odd diffs when refactoring). Which one you pick doesn't matter.
Re:Show HN: Learn and practice modern JavaScript by ficklepickle on Thursday January 03, 2019 @08:54PM (#18821340)
The behavior is slightly different. "\n" is a newline, '\n' is a backslash and an n.
Re:Show HN: Learn and practice modern JavaScript by lauritzsh on Friday January 04, 2019 @05:36AM (#18823057)
Not in JavaScript. \n is treated as a newline in both cases. Try it out in the console.
Re:Show HN: Learn and practice modern JavaScript by chrisweekly on Thursday January 03, 2019 @02:00PM (#18818034)
... Unless you would prefer to skip the extra keypress required for ".