How can you add a comment in a JavaScript?
-
<!--This is a comment-->
-
'This is a comment
-
//This is a comment
-
/*This is a comment */
C
Correct answer
Explanation
Single-line comments in JavaScript begin with two forward slashes (//). Option A uses HTML comment syntax which doesn't work in JavaScript, option B uses a single quote which is for string literals, and option D shows multi-line comment syntax (which works but isn't the standard single-line approach).