Multiple choice technology web technology

How can you add a comment in a JavaScript?

  1. //This is a comment

  2. <!--This is a comment-->

  3. 'This is a comment

  4. /*This is a comment

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

JavaScript uses // for single-line comments. Option A is correct. Option B is HTML comment syntax, option C is not valid comment syntax, and option D is incomplete (multi-line comments need both /* and */).