How do I fix comment showing on code in javascript?


Im trying to download jQuery into my document via my js file.
when i do document.write however, the "https://" is marked as a comment.

function downloadjQuery() {;
    document.write("<script src=""></script>");


Your quote use is incorrect. You closed the quotes before the link.

Instead of:

document.write("<script src="link"></script>");

You should do:

document.write("<script src='link'></script>");

When you have to use quotes multiple times, you can also use ' instead of " four times.
Also, if you want to keep the raw version of the comment, you can type \ before //.


(Correct Usage)

\//I printed a raw version of a comment.

(Incorrect Usage)

//I did not print a raw version of a comment.

Answered By – Bella

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published