Topic on Manual talk:Coding conventions/JavaScript

Summary by Krinkle

Single quotes indeed.

Amire80 (talkcontribs)

What is the convention for quotes - double or single?

It has little meaning, but would be nice for consistency.

jQuery suggests double.

He7d3r (talkcontribs)

If I remember correctly it is single.

Krinkle (talkcontribs)

Single quotes indeed.

For JavaScript files quotation is purely stylistic as string literals in JavaScript are specified as either wrapped in double quotes or single quotes. There is no magic functionality or different escaping (e.g. no need for double quotes to use \n or something).

In PHP we use both because of magic quotes, though in PHP we also prefer single quotes when magic functionality is not intended.