I want to write the following string, but it gives the error - Uncaught SyntaxError: Unexpected identifier
var str=" <span class="math-tex"> /( /sum /) </span> ";
console.log(str);
I want to write the following string, but it gives the error - Uncaught SyntaxError: Unexpected identifier
var str=" <span class="math-tex"> /( /sum /) </span> ";
console.log(str);
Use single quotes. It fails because your input string contains double quotes and the quotes you actually used to assign that string to a variable is also double quotes. So when the interpreter sees the second double quotes, it would consider that point as end of the string.