90.2k views
3 votes
How can you add a comment in JavaScript?

a) 'This is a comment
b)
c) //This is a comment
d) /*This is a comment */

1 Answer

1 vote

Final answer:

In JavaScript, you can add comments using two forward slashes (//) or by enclosing the comment in a block using a forward slash followed by an asterisk (/*).

Step-by-step explanation:

In JavaScript, you can add a comment using two forward slashes (//) or by enclosing the comment in a block using a forward slash followed by an asterisk (/*). Both methods allow you to add comments to your code to provide explanations or make notes that are not executed by the program.

User Jake Burton
by
7.8k points