20
Context
In PHP, there is a difference between using single and double quotes. In this case, single quotes are for "strings
common", and double quotation marks, used when processing string
(concatenate, for example).
Question
Is there any difference between the use of " and ' for strings
Javascript? Are there any changes in performance, or conflicts with use strict
, for example?
Example
alert('foo'); // Aspas simples
alert("bar"); // Aspas duplas
In languages where single and double quotes are interchangeable I like to use a convention to say when using quotation marks of each type. A convention I like is single quotes for "internal" system strings and double quotes for things that will be shown to the user.
– hugomg
It’s a matter of taste even. Simple quotes make you save a shift.
– user622
Quotation marks of the same type can be used without generating any conflict, if you do so ""content"", the result will be this "content" in the output of a function, that is, the backslash with the quotation marks together make the browser identify them differently, even if they are equal.
– Rogerio de Moraes