Double quote in JavaScript string

html, javascript

Solution

Use single quotes.

error += '<li> this is not the name "....." </li>\n';

Or escape the double quotes.

error += "<li> this is not the name \".....\" </li>\n";

Problem

How can I include a double quote in a JavaScript string to be shown in the browser? I am working on my JavaScript homework and I have to include double quotes in the middle of my list as shown below: ``` if (i == 0) { error += "<li> this is not the name "....." </li>\n" } ```

Original source