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

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.



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.




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

Search: