Possible Duplicate:
When should I use double or single quotes in JavaScript?
Do ""
and ''
have different meanings in JavaScript?
Because I keep seeing those two usages in jQuery, for instance:
$("")
and
$('')
The strict equality operator ( === ) checks whether its two operands are equal, returning a Boolean result. Unlike the equality operator, the strict equality operator always considers operands of different types to be different.
The logical OR ( || ) operator (logical disjunction) for a set of operands is true if and only if one or more of its operands is true. It is typically used with boolean (logical) values.
No, they mean the same thing; they are both just JavaScript string literals.
Having have multiple different quote styles is useful so that:
"some string with 'single quotes' in it"
, or 'a string with "double quotes" in it'
, and<button onclick="alert('foo')">Click me</div>
Read about strings in JavaScript. There is no difference.
But as HTML properties are often defined with double-quotes, I would use single-quotes, which makes code like
$('<a href="someurl" />')
easier to write.
Use the one with which you have less characters to escape inside the string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With