Hi I want to do the following, but don't know how to write the quotation marks
allSearchResults[0]="<li><a href="CXS101289/"> CXS101289/</a></li>";
It shall be quotation marks where the currently are.
In JavaScript, single quotes ( '' ) and double quotes ( “” ) are used to create string literals. Most developers use single or double quotes as they prefer, and sometimes they let their code formatters decide what to use.
Both single (' ') and double (" ") quotes are used to represent a string in Javascript. Choosing a quoting style is up to you and there is no special semantics for one style over the other. Nevertheless, it is important to note that there is no type for a single character in javascript, everything is always a string!
We use <q> tag, to add short quotation marks in HTML. And if we want to quote for multiple lines, use <blockquote> tag. We can also use the cite attribute inside the <blockquote> tag to indicate the source of the quotation in URL form.
mix single and double quotes:
// single outside, double inside quotes
allSearchResults[0] = '<li><a href="CXS101289/">CXS101289/</a></li>';
or
// double outside, single inside quotes
allSearchResults[0] = "<li><a href='CXS101289/'>CXS101289/</a></li>";
use one set of quotes but escape inside ones:
// double escaped quotes
allSearchResults[0] = "<li><a href=\"CXS101289/\">CXS101289/</a></li>";
or
// single escaped quotes
allSearchResults[0] = '<li><a href=\'CXS101289/\'>CXS101289/</a></li>';
First approach with mixing is usually easier, because it presents less work since you only have to change the opening and closing quote.
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