Hacker News new | ask | show | jobs
by lee 4009 days ago
The rationale I have for using single quotes over double quotes in javascript is that when embedding HTML elements, attributes are often quoted in double quotes.

So it's much nicer to write

    '<a href="www.google.com">Google</a>'
than to constantly escape argument strings.
2 comments

In ES6, that's no longer a problem since most HTML elements will involve interpolation with template strings and backticks.

    `<a href="${ site.url }">${ site.name }</a>`

    "<a href='www.google.com'>Google</a>"
Will work as well though.